I'm having trouble making sense of this PHPStan error. PHPStan is saying I need to provide the class string of an EntityRepository of an object. I am providing the class string of a ServiceEntityRepository (which extends EntityRepository) of class "Schedule".
Parameter $repositoryClass of attribute class Doctrine\ORM\Mapping\Entity constructor expects class-string<Doctrine\ORM\EntityRepository<T of object>>|null, 'App\Repository\ScheduleRepository' given.
Here is the offending code:
namespace App\Entity\Schedule;
use App\Repository\ScheduleRepository;
#[ORM\Entity(repositoryClass: ScheduleRepository::class)]
class Schedule implements JsonSerializable
{
// ...
And the repository class referenced:
namespace App\Repository;
use App\Entity\Schedule\Schedule;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
/*
* @extends ServiceEntityRepository<Schedule>
*/
class ScheduleRepository extends ServiceEntityRepository
{
// ...
(Note: ServiceEntityRepository extends EntityRepository.)
This was a bug in phpstan.
Solution: Upgrade phpstan to 1.6.8.