deprecation-detector
deprecation-detector copied to clipboard
Deprecation $this->get('request')
Running deprecator detects $this->getRequest() but i found some very old code that was using in Controller
$this->get('request')
which will be deprecated in 3.0
/** * Gets a container service by its id. * * @param string $id The service id * * @return object The service */ public function get($id) { if ('request' === $id) { @trigger_error('The "request" service is deprecated and will be removed in 3.0. Add a typehint for Symfony\Component\HttpFoundation\Request to your controller parameters to retrieve the request instead.', E_USER_DEPRECATED); }
return $this->container->get($id);
}
Deprecator needs to generate error here (it needs rule)
Thanks :) !
I think this is a similar problematic as #66
The problem is that the detector only checks the return type of $container->get()
but $container->get('request')
returns a request object which is not deprecated
Having a service named request
generally isn't deprecated (for example, you can use the component without the rest of the framework and have such a service in your project).