for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Doctrine;
use App\Entity\Message;
use App\Entity\MessageAttachment;
use App\Filesystem\MessageFilesystem;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
/**
* Listens to Message/MessageAttachment removals in order to remove files and directories from the filesystem.
*/
class MessageRemoveSubscriber implements EventSubscriber {
public function __construct(private MessageFilesystem $filesystem)
{
}
public function postRemove(LifecycleEventArgs $eventArgs) {
$entity = $eventArgs->getEntity();
Doctrine\ORM\Event\LifecycleEventArgs::getEntity()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
$entity = /** @scrutinizer ignore-deprecated */ $eventArgs->getEntity();
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
if($entity instanceof Message) {
$this->filesystem->removeMessageDirectoy($entity);
} else if($entity instanceof MessageAttachment) {
$this->filesystem->removeMessageAttachment($entity);
* @inheritDoc
public function getSubscribedEvents(): array {
return [
Events::postRemove
];
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.