/** * Constructor. * * @param Request|RequestStack $requestStack A RequestStack instance or a Request instance * * @deprecated since 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0 */ public function __construct($requestStack) { if ($requestStack instanceof Request) { $this->session = $requestStack->getSession(); } elseif ($requestStack instanceof RequestStack) { $this->requestStack = $requestStack; } else { throw new \InvalidArgumentException('RequestHelper only accepts a Request or a RequestStack instance.'); } }
/** * Constructor. * * @param Request|RequestStack $requestStack A RequestStack instance or a Request instance * * @deprecated since version 2.5, passing a Request instance is deprecated and support for it will be removed in 3.0. */ public function __construct($requestStack) { if ($requestStack instanceof Request) { @trigger_error('Since version 2.5, passing a Request instance into the ' . __METHOD__ . ' is deprecated and support for it will be removed in 3.0. Inject a Symfony\\Component\\HttpFoundation\\RequestStack instance instead.', E_USER_DEPRECATED); $this->session = $requestStack->getSession(); } elseif ($requestStack instanceof RequestStack) { $this->requestStack = $requestStack; } else { throw new \InvalidArgumentException('RequestHelper only accepts a Request or a RequestStack instance.'); } }