Skip to content

EntityRepository.stub missing Selectable interface #785

Description

@mtreffler

It seems that compared to doctrine EntityRepository, the stub is missing generics and implementation of Selectable interface.

What i mean is that stub is declared:

/**
 * @template T of object
 * @implements ObjectRepository<T>
 */
class EntityRepository implements ObjectRepository
{
// ...
}

instead of:

 /**
 * @template T of object
 * @template-implements Selectable<int,T>
 * @template-implements ObjectRepository<T>
 */
class EntityRepository implements ObjectRepository, Selectable
{
// ...
}

This causes problems when I'm trying to make interface for mine repository that would cover all the methods:

/**
 * @extends EntityRepository<MyEntity>
 */
class MyRepository extends EntityRepository implements MyRepositoryInterface
{
// ...
}
/**
 * @extends ObjectRepository<MyEntity>
 * @extends Selectable<int, MyEntity>
 */
interface MyRepositoryInterface extends ObjectRepository, Selectable
{
// ...
}

This works fine without phpstan/phpstan-doctrine but fails due to stub with:

 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   VaultRepository.php                                                                                                                                                                                 
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  13     Class Doctrine\ORM\EntityRepository specifies template type T of interface Doctrine\Common\Collections\Selectable as mixed but it's already specified as Entity\MyEntity.  
         🪪  generics.interfaceConflict                                                                                                                                                                      
  13     Class Doctrine\ORM\EntityRepository specifies template type TKey of interface Doctrine\Common\Collections\Selectable as mixed but it's already specified as int.                                    
         🪪  generics.interfaceConflict                                                                                                                                                                      
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions