Skip to content

Add some Generics#6969

Merged
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
VincentLanglet:generics
Jun 9, 2025
Merged

Add some Generics#6969
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
VincentLanglet:generics

Conversation

@VincentLanglet
Copy link
Contributor

Hi @javiereguiluz

I recently tried easy admin and it works fine but I'm getting some PHPStan error because methods like
CrudControllerInterface::updateEntity has no param type. Since this interface has a method getEntityFqcn we could make it a generic. Same for some others classes.

This would be really useful for PHPStan users like me.

Also, I tried the phpstan level 6 on this codebase and there is

  • Error for array without detailled
  • Error for generics without detailled
  • 351 errors for missing parameter/return type.

Would you be interested if I improve the type-coverage of this projet to bump phpstan to level 6 ?

@javiereguiluz
Copy link
Collaborator

Vincent, thanks for testing this project and quickly improving it in this way 🙏

I like this a lot, so let's merge it ASAP.

Yes, ideally we'd like to keep increasing PHPStan level. I know it's a lot of work, but if you could submit some PRs to fix some of the pending issues, that'd be amazing 🙇 Thanks!

@javiereguiluz javiereguiluz merged commit 8c5e5f3 into EasyCorp:4.x Jun 9, 2025
15 checks passed
@VincentLanglet
Copy link
Contributor Author

Yes, ideally we'd like to keep increasing PHPStan level. I know it's a lot of work, but if you could submit some PRs to fix some of the pending issues, that'd be amazing 🙇 Thanks!

Sure, if something like #6979 is ok for you, I can do more.

javiereguiluz added a commit that referenced this pull request Jun 11, 2025
… (glaubinix)

This PR was merged into the 4.x branch.

Discussion
----------

CrudControllerInterface: add missing EntityDto generics

Following #6969 this adds missing generic PHPDoc to `CrudControllerInterface` methods that have `EntityDto` as an argument. Currently this results in PHPStan errors like

```
  38     Method MyEntityCrudController::createIndexQueryBuilder() has parameter $entityDto with generic class EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto but does not specify its types:
         TEntity
         🪪 missingType.generics
```

Commits
-------

98b3c31 CrudControllerInterface: add missing EntityDto generics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants