KnpLabs / KnpMenuBundle

Object Oriented menus for your Symfony project.

Home Page:http://knplabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$voter->setRequest() deprecated in KnpMenu

mgiraud opened this issue · comments

Hello,

The VoterInitializerListener sets the request to voters : https://github.com/KnpLabs/KnpMenuBundle/blob/master/EventListener/VoterInitializerListener.php#L16

public function onKernelRequest(GetResponseEvent $event)
    {
        if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
            return;
        }
        foreach ($this->voters as $voter) {
            if (method_exists($voter, 'setRequest')) {
                $voter->setRequest($event->getRequest());
            }
        }
    }

However the setRequest is deprecated in the KnpMenu 2.3 : https://github.com/KnpLabs/KnpMenu/blob/master/src/Knp/Menu/Matcher/Voter/RouteVoter.php#L51

which triggers deprecation warnings when using phpunit