Skip to content

CrudControllerInterface: add missing EntityDto generics#6981

Merged
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
glaubinix:patch-2
Jun 11, 2025
Merged

CrudControllerInterface: add missing EntityDto generics#6981
javiereguiluz merged 1 commit intoEasyCorp:4.xfrom
glaubinix:patch-2

Conversation

@glaubinix
Copy link
Contributor

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

@javiereguiluz
Copy link
Collaborator

Nice! Thanks a lot for providing PRs like this to improve generics. Love them!

@javiereguiluz javiereguiluz merged commit 0f6729d into EasyCorp:4.x Jun 11, 2025
15 checks passed
@VincentLanglet
Copy link
Contributor

I opened #6986 to reduce the negative impact of this generic.

javiereguiluz added a commit that referenced this pull request Jun 17, 2025
…s (VincentLanglet)

This PR was merged into the 4.x branch.

Discussion
----------

Use a default template value for recently created Generics

I tried the recent 4.24.8 branch and getting some errors I tried to fix.

This
- avoid error like reported in PR #6981 (comment)
- avoid ~200 missing generic types in EasyAdminBundle code base

So it should be simpler for user to start using those generics.

It will still be possible later to improve the typing of existing interface like
```
interface EntityRepositoryInterface
{
    public function createQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder;
}
```
into
```
/** `@template` TEntity of object */
interface EntityRepositoryInterface
{
    /** `@param` EntityDto<TEntity> $entityDto */
    public function createQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder;
}
```
when needed.

Commits
-------

827cb3f Use default value for template
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.

3 participants