Skip to content

EntityRepository::__construct() expects Doctrine\ORM\EntityManager instead of actual required EntityManagerInterface #7518

@koftikes

Description

@koftikes

Bug Report

When I do phpstan check of my code.

Q A
BC Break yes
Version 2.6.x

Summary

Parameter #1 $em of method Doctrine\ORM\EntityRepository::__construct() expects Doctrine\ORM\EntityManager, Doctrine\ORM\EntityManagerInterface given.

How to reproduce

class RequestMasterRepository extends EntityRepository implements ServiceEntityRepositoryInterface
{
    /**
     * CompanyConfigRepository constructor.
     *
     * @param EntityManagerInterface $manager
     */
    public function __construct(EntityManagerInterface $manager)
    {
        parent::__construct($manager, $manager->getClassMetadata(RequestMaster::class));
    }
....

And run phpstam level 7 to this file.

vendor/bin/phpstan analyse -c phpstan.neon -l max src/AppBundle/Repository/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions