for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kunstmaan\AdminListBundle\EventSubscriber;
use Kunstmaan\AdminListBundle\Entity\OverviewNavigationInterface;
use Kunstmaan\NodeBundle\Event\Events;
use Kunstmaan\NodeBundle\Event\NodeEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
/**
* Class AdminListSubscriber.
*/
class AdminListSubscriber implements EventSubscriberInterface
{
* @var RouterInterface
private $router;
* ArticleSubscriber constructor.
*
* @param RouterInterface $router
public function __construct(RouterInterface $router)
$this->router = $router;
}
* @return array
array<*,string>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
public static function getSubscribedEvents()
return [
Events::POST_DELETE => 'postDelete',
];
* @param NodeEvent $event
public function postDelete(NodeEvent $event)
$page = $event->getPage();
// Redirect to admin list when deleting a page that implements the OverviewNavigationInterface.
if ($page instanceof OverviewNavigationInterface) {
$route = $this->router->generate($page->getOverViewRoute());
$response = new RedirectResponse($route);
$event->setResponse($response);
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.