Reputation: 33
Deprecated the ListenerInterface, turn your listeners into callables instead
Question related to Symfony 4.3 after this update, they update these security updates. 1.Deprecated the ListenerInterface, turn your listeners into callables instead
How can i use callbacks with an interface?
Upvotes: 1
Views: 1823
Reputation: 428
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
class MyListener implements ListenerInterface
{
public function handle(GetResponseEvent $event)
{
// code
}
}
Turn listeners into callables. Change your code to:
use Symfony\Component\HttpKernel\Event\RequestEvent;
class MyListener
{
public function __invoke(RequestEvent $event)
{
// code
}
}
Then symfony or you can call Mylistener
as a function
$myListener = new MyListener();
$myListener($event);
Upvotes: 7