弃用了 ListenerInterface,将您的听众变成可调用对象
Deprecated the ListenerInterface, turn your listeners into callables instead
弃用了 ListenerInterface,将您的侦听器改为可调用对象
与 Symfony 4.3 相关的问题
在此更新之后,他们会更新这些安全更新。
1.Deprecated ListenerInterface,将你的监听器变成可调用对象
如何在接口中使用回调?
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
class MyListener implements ListenerInterface
{
public function handle(GetResponseEvent $event)
{
// code
}
}
将听众变成可调用对象。将您的代码更改为:
use Symfony\Component\HttpKernel\Event\RequestEvent;
class MyListener
{
public function __invoke(RequestEvent $event)
{
// code
}
}
然后symfony或者你可以调用Mylistener
作为一个函数
$myListener = new MyListener();
$myListener($event);
弃用了 ListenerInterface,将您的侦听器改为可调用对象
与 Symfony 4.3 相关的问题 在此更新之后,他们会更新这些安全更新。 1.Deprecated ListenerInterface,将你的监听器变成可调用对象
如何在接口中使用回调?
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
class MyListener implements ListenerInterface
{
public function handle(GetResponseEvent $event)
{
// code
}
}
将听众变成可调用对象。将您的代码更改为:
use Symfony\Component\HttpKernel\Event\RequestEvent;
class MyListener
{
public function __invoke(RequestEvent $event)
{
// code
}
}
然后symfony或者你可以调用Mylistener
作为一个函数
$myListener = new MyListener();
$myListener($event);