Symfony httplug 包句柄缺少 EventSubscriberInterface

Symfony httplug bundle handle missing EventSubscriberInterface

在 Symfony 5.1.8 项目中,我将 httplug 包更新到版本 1.19.0。

更新日志中提到:

ConfiguredClientsStrategy no longer implements EventSubscriberInterface, this has been moved to ConfiguredClientsStrategyListener to avoid initializing the strategy on every request.

这会导致 In

中出现错误

EventDispatcher.php line 270

Failed to create closure from callable: class 'Http\HttplugBundle\Discovery\ConfiguredClientsStrategy' does not have a method 'onEvent'

我在 Symfony 4.4.16 上遇到了同样的问题,我不得不手动删除旧缓存以在生产中修复它:

rm -rf var/cache/prod && bin/console cache:clear