Closed
Description
Hi!
this is a bug report/question.
In doctrine persistence LifecycleEventArgs class as parentclass and doctrine orm LifecycleEventArgs as child class
the method getEntity
is deprecated and will be removed in parentclass:
https://github.com/doctrine/persistence/blob/2.5.x/src/Persistence/Event/LifecycleEventArgs.php#L39
but overwritten and not deprecated and will be kept in child class:
https://github.com/doctrine/orm/blob/2.12.x/lib/Doctrine/ORM/Event/LifecycleEventArgs.php#L23
When I use phpstan with deprecation rules on my class
<?php
declare(strict_types=1);
namespace App\EventSubscriber;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
class MySubscriber implements EventSubscriberInterface
{
public function getSubscribedEvents(): array
{
return [Events::postPersist];
}
public function postPersist(LifecycleEventArgs $args): void
{
$entity = $args->getEntity();
// ...
}
}
I got the error message:
Call to deprecated method getEntity() of class Doctrine\ORM\Event\LifecycleEventArgs.
Looks like the detprecated state is inherited. Is it a bug, or is it expected?
Metadata
Metadata
Assignees
Labels
No labels