X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fhttp-kernel%2FEventListener%2FLocaleListener.php;fp=vendor%2Fsymfony%2Fhttp-kernel%2FEventListener%2FLocaleListener.php;h=99fc78679390cd55766620cd6345c2d2c81a5e38;hp=0ff3a86373a57e2131bc39c06a1cb6ed90106353;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/vendor/symfony/http-kernel/EventListener/LocaleListener.php index 0ff3a8637..99fc78679 100644 --- a/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ b/vendor/symfony/http-kernel/EventListener/LocaleListener.php @@ -22,11 +22,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Initializes the locale based on the current request. * - * This listener works in 2 modes: - * - * * 2.3 compatibility mode where you must call setRequest whenever the Request changes. - * * 2.4+ mode where you must pass a RequestStack instance in the constructor. - * * @author Fabien Potencier */ class LocaleListener implements EventSubscriberInterface @@ -38,62 +33,17 @@ class LocaleListener implements EventSubscriberInterface /** * Constructor. * - * RequestStack will become required in 3.0. - * * @param RequestStack $requestStack A RequestStack instance * @param string $defaultLocale The default locale * @param RequestContextAwareInterface|null $router The router - * - * @throws \InvalidArgumentException */ - public function __construct($requestStack = null, $defaultLocale = 'en', $router = null) + public function __construct(RequestStack $requestStack, $defaultLocale = 'en', RequestContextAwareInterface $router = null) { - if ((null !== $requestStack && !$requestStack instanceof RequestStack) || $defaultLocale instanceof RequestContextAwareInterface || $router instanceof RequestStack) { - $tmp = $router; - $router = func_num_args() < 2 ? null : $defaultLocale; - $defaultLocale = $requestStack; - $requestStack = func_num_args() < 3 ? null : $tmp; - - @trigger_error('The '.__METHOD__.' method now requires a RequestStack to be given as first argument as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED); - } elseif (!$requestStack instanceof RequestStack) { - @trigger_error('The '.__METHOD__.' method now requires a RequestStack instance as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED); - } - - if (null !== $requestStack && !$requestStack instanceof RequestStack) { - throw new \InvalidArgumentException('RequestStack instance expected.'); - } - if (null !== $router && !$router instanceof RequestContextAwareInterface) { - throw new \InvalidArgumentException('Router must implement RequestContextAwareInterface.'); - } - $this->defaultLocale = $defaultLocale; $this->requestStack = $requestStack; $this->router = $router; } - /** - * Sets the current Request. - * - * This method was used to synchronize the Request, but as the HttpKernel - * is doing that automatically now, you should never call it directly. - * It is kept public for BC with the 2.3 version. - * - * @param Request|null $request A Request instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setRequest(Request $request = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - - if (null === $request) { - return; - } - - $this->setLocale($request); - $this->setRouterContext($request); - } - public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); @@ -105,10 +55,6 @@ class LocaleListener implements EventSubscriberInterface public function onKernelFinishRequest(FinishRequestEvent $event) { - if (null === $this->requestStack) { - return; // removed when requestStack is required - } - if (null !== $parentRequest = $this->requestStack->getParentRequest()) { $this->setRouterContext($parentRequest); }