diff --git a/CHANGELOG.md b/CHANGELOG.md index 088e1803f4..bb3ed3f155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,24 @@ CHANGELOG * removed `Symfony\Component\HttpKernel\Kernel::init()` * removed `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle()` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle()` + * removed `Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher::setProfiler()` + * removed `Symfony\Component\HttpKernel\EventListener\FragmentListener::getLocalIpAddresses()` + * removed `Symfony\Component\HttpKernel\EventListener\LocaleListener::setRequest()` + * removed `Symfony\Component\HttpKernel\EventListener\RouterListener::setRequest()` + * removed `Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest()` + * removed `Symfony\Component\HttpKernel\Fragment\FragmentHandler::setRequest()` + * removed `Symfony\Component\HttpKernel\HttpCache\Esi::hasSurrogateEsiCapability()` + * removed `Symfony\Component\HttpKernel\HttpCache\Esi::addSurrogateEsiCapability()` + * removed `Symfony\Component\HttpKernel\HttpCache\Esi::needsEsiParsing()` + * removed `Symfony\Component\HttpKernel\HttpCache\HttpCache::getEsi()` + * removed `Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel` + * removed `Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass` + * removed `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` + * removed `Symfony\Component\HttpKernel\EventListener\EsiListener` + * removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategy` + * removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategyInterface` + * removed `Symfony\Component\HttpKernel\Log\LoggerInterface` + * removed `Symfony\Component\HttpKernel\Log\NullLogger` 2.7.0 ----- diff --git a/DataCollector/DumpDataCollector.php b/DataCollector/DumpDataCollector.php index 6c63ad21ab..24e150dce7 100644 --- a/DataCollector/DumpDataCollector.php +++ b/DataCollector/DumpDataCollector.php @@ -199,12 +199,8 @@ public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) $dumps = array(); foreach ($this->data as $dump) { - if (method_exists($dump['data'], 'withMaxDepth')) { - $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); - } else { - // getLimitedClone is @deprecated, to be removed in 3.0 - $dumper->dump($dump['data']->getLimitedClone($maxDepthLimit, $maxItemsPerDepth)); - } + $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); + rewind($data); $dump['data'] = stream_get_contents($data); ftruncate($data, 0); diff --git a/Debug/TraceableEventDispatcher.php b/Debug/TraceableEventDispatcher.php index 0a82d76525..9644b049b3 100644 --- a/Debug/TraceableEventDispatcher.php +++ b/Debug/TraceableEventDispatcher.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Debug; use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher; -use Symfony\Component\HttpKernel\Profiler\Profiler; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\Event; @@ -25,22 +24,6 @@ */ class TraceableEventDispatcher extends BaseTraceableEventDispatcher { - /** - * Sets the profiler. - * - * The traceable event dispatcher does not use the profiler anymore. - * The job is now done directly by the Profiler listener and the - * data collectors themselves. - * - * @param Profiler|null $profiler A Profiler instance - * - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function setProfiler(Profiler $profiler = null) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); - } - /** * {@inheritdoc} */ diff --git a/DependencyInjection/ContainerAwareHttpKernel.php b/DependencyInjection/ContainerAwareHttpKernel.php deleted file mode 100644 index 4d249f69ef..0000000000 --- a/DependencyInjection/ContainerAwareHttpKernel.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Scope; - -/** - * Adds a managed request scope. - * - * @author Fabien Potencier - * @author Johannes M. Schmitt - * - * @deprecated since version 2.7, to be removed in 3.0. - */ -class ContainerAwareHttpKernel extends HttpKernel -{ - protected $container; - - /** - * Constructor. - * - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param ContainerInterface $container A ContainerInterface instance - * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance - * @param RequestStack $requestStack A stack for master/sub requests - */ - public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null) - { - parent::__construct($dispatcher, $controllerResolver, $requestStack); - - $this->container = $container; - - // the request scope might have been created before (see FrameworkBundle) - if (!$container->hasScope('request')) { - $container->addScope(new Scope('request')); - } - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - $this->container->enterScope('request'); - $this->container->set('request', $request, 'request'); - - try { - $response = parent::handle($request, $type, $catch); - } catch (\Exception $e) { - $this->container->set('request', null, 'request'); - $this->container->leaveScope('request'); - - throw $e; - } - - $this->container->set('request', null, 'request'); - $this->container->leaveScope('request'); - - return $response; - } -} diff --git a/DependencyInjection/FragmentRendererPass.php b/DependencyInjection/FragmentRendererPass.php index c0cd8d4d5d..bed193c818 100644 --- a/DependencyInjection/FragmentRendererPass.php +++ b/DependencyInjection/FragmentRendererPass.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; /** @@ -59,14 +58,7 @@ public function process(ContainerBuilder $container) } foreach ($tags as $tag) { - if (!isset($tag['alias'])) { - trigger_error(sprintf('Service "%s" will have to define the "alias" attribute on the "%s" tag as of Symfony 3.0.', $id, $this->rendererTag), E_USER_DEPRECATED); - - // register the handler as a non-lazy-loaded one - $definition->addMethodCall('addRenderer', array(new Reference($id))); - } else { - $definition->addMethodCall('addRendererService', array($tag['alias'], $id)); - } + $definition->addMethodCall('addRendererService', array($tag['alias'], $id)); } } } diff --git a/DependencyInjection/RegisterListenersPass.php b/DependencyInjection/RegisterListenersPass.php deleted file mode 100644 index 386476b3c9..0000000000 --- a/DependencyInjection/RegisterListenersPass.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -trigger_error('The '.__NAMESPACE__.'\RegisterListenersPass is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead.', E_USER_DEPRECATED); - -use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass as BaseRegisterListenersPass; - -/** - * Compiler pass to register tagged services for an event dispatcher. - * - * @deprecated since version 2.5, to be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead. - */ -class RegisterListenersPass extends BaseRegisterListenersPass -{ -} diff --git a/EventListener/ErrorsLoggerListener.php b/EventListener/ErrorsLoggerListener.php deleted file mode 100644 index 230a949436..0000000000 --- a/EventListener/ErrorsLoggerListener.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -trigger_error('The '.__NAMESPACE__.'\ErrorsLoggerListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\DebugHandlersListener class instead.', E_USER_DEPRECATED); - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Injects the logger into the ErrorHandler, so that it can log various errors. - * - * @author Colin Frei - * @author Konstantin Myakshin - * - * @deprecated since version 2.6, to be removed in 3.0. Use the DebugHandlersListener class instead. - */ -class ErrorsLoggerListener implements EventSubscriberInterface -{ - private $channel; - private $logger; - - public function __construct($channel, LoggerInterface $logger = null) - { - $this->channel = $channel; - $this->logger = $logger; - } - - public function injectLogger() - { - if (null !== $this->logger) { - ErrorHandler::setLogger($this->logger, $this->channel); - $this->logger = null; - } - } - - public static function getSubscribedEvents() - { - return array(KernelEvents::REQUEST => array('injectLogger', 2048)); - } -} diff --git a/EventListener/EsiListener.php b/EventListener/EsiListener.php deleted file mode 100644 index 9bede00564..0000000000 --- a/EventListener/EsiListener.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -trigger_error('The '.__NAMESPACE__.'\EsiListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\SurrogateListener class instead.', E_USER_DEPRECATED); - -/** - * EsiListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for ESI. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use SurrogateListener instead - */ -class EsiListener extends SurrogateListener -{ -} diff --git a/EventListener/ExceptionListener.php b/EventListener/ExceptionListener.php index fc2efed86b..4d92a2484c 100644 --- a/EventListener/ExceptionListener.php +++ b/EventListener/ExceptionListener.php @@ -107,10 +107,6 @@ protected function duplicateRequest(\Exception $exception, Request $request) '_controller' => $this->controller, 'exception' => FlattenException::create($exception), 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, - // keep for BC -- as $format can be an argument of the controller callable - // see src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php - // @deprecated since version 2.4, to be removed in 3.0 - 'format' => $request->getRequestFormat(), ); $request = $request->duplicate(null, null, $attributes); $request->setMethod('GET'); diff --git a/EventListener/FragmentListener.php b/EventListener/FragmentListener.php index 3309c2bef9..b85b4a0cd2 100644 --- a/EventListener/FragmentListener.php +++ b/EventListener/FragmentListener.php @@ -87,18 +87,6 @@ protected function validateRequest(Request $request) throw new AccessDeniedHttpException(); } - /** - * @deprecated since version 2.3.19, to be removed in 3.0. - * - * @return string[] - */ - protected function getLocalIpAddresses() - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.3.19 and will be removed in 3.0.', E_USER_DEPRECATED); - - return array('127.0.0.1', 'fe80::1', '::1'); - } - public static function getSubscribedEvents() { return array( diff --git a/EventListener/LocaleListener.php b/EventListener/LocaleListener.php index ef3911694a..fa302d8b1b 100644 --- a/EventListener/LocaleListener.php +++ b/EventListener/LocaleListener.php @@ -45,29 +45,6 @@ public function __construct($defaultLocale = 'en', RequestContextAwareInterface $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(); diff --git a/EventListener/ProfilerListener.php b/EventListener/ProfilerListener.php index 781475a992..cc762a0704 100644 --- a/EventListener/ProfilerListener.php +++ b/EventListener/ProfilerListener.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\EventListener; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; @@ -49,13 +48,6 @@ class ProfilerListener implements EventSubscriberInterface */ public function __construct(Profiler $profiler, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false, RequestStack $requestStack = null) { - if (null === $requestStack) { - // Prevent the deprecation notice to be triggered all the time. - // The onKernelRequest() method fires some logic only when the - // RequestStack instance is not provided as a dependency. - trigger_error('Since version 2.4, the '.__METHOD__.' method must accept a RequestStack instance to get the request instead of using the '.__CLASS__.'::onKernelRequest method that will be removed in 3.0.', E_USER_DEPRECATED); - } - $this->profiler = $profiler; $this->matcher = $matcher; $this->onlyException = (bool) $onlyException; @@ -79,16 +71,6 @@ public function onKernelException(GetResponseForExceptionEvent $event) $this->exception = $event->getException(); } - /** - * @deprecated since version 2.4, to be removed in 3.0. - */ - public function onKernelRequest(GetResponseEvent $event) - { - if (null === $this->requestStack) { - $this->requests[] = $event->getRequest(); - } - } - /** * Handles the onKernelResponse event. * @@ -154,9 +136,6 @@ public function onKernelTerminate(PostResponseEvent $event) public static function getSubscribedEvents() { return array( - // kernel.request must be registered as early as possible to not break - // when an exception is thrown in any other kernel.request listener - KernelEvents::REQUEST => array('onKernelRequest', 1024), KernelEvents::RESPONSE => array('onKernelResponse', -100), KernelEvents::EXCEPTION => 'onKernelException', KernelEvents::TERMINATE => array('onKernelTerminate', -1024), diff --git a/EventListener/RouterListener.php b/EventListener/RouterListener.php index 9a49e2f3c8..a83fc0f7d4 100644 --- a/EventListener/RouterListener.php +++ b/EventListener/RouterListener.php @@ -67,34 +67,12 @@ public function __construct($matcher, RequestContext $context = null, LoggerInte throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); } - if (!$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); - } - $this->matcher = $matcher; $this->context = $context ?: $matcher->getContext(); $this->requestStack = $requestStack; $this->logger = $logger; } - /** - * 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 made private in 3.0.', E_USER_DEPRECATED); - - $this->setCurrentRequest($request); - } - private function setCurrentRequest(Request $request = null) { if (null !== $request && $this->request !== $request) { diff --git a/Fragment/FragmentHandler.php b/Fragment/FragmentHandler.php index eae715e8ac..288d10c43f 100644 --- a/Fragment/FragmentHandler.php +++ b/Fragment/FragmentHandler.php @@ -67,24 +67,6 @@ public function addRenderer(FragmentRendererInterface $renderer) $this->renderers[$renderer->getName()] = $renderer; } - /** - * 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); - - $this->request = $request; - } - /** * Renders a URI and returns the Response content. * diff --git a/HttpCache/Esi.php b/HttpCache/Esi.php index f7031b81fa..fcd91b4928 100644 --- a/HttpCache/Esi.php +++ b/HttpCache/Esi.php @@ -76,22 +76,6 @@ public function hasSurrogateCapability(Request $request) return false !== strpos($value, 'ESI/1.0'); } - /** - * Checks that at least one surrogate has ESI/1.0 capability. - * - * @param Request $request A Request instance - * - * @return bool true if one surrogate has ESI/1.0 capability, false otherwise - * - * @deprecated since version 2.6, to be removed in 3.0. Use hasSurrogateCapability() instead - */ - public function hasSurrogateEsiCapability(Request $request) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasSurrogateCapability() method instead.', E_USER_DEPRECATED); - - return $this->hasSurrogateCapability($request); - } - /** * Adds ESI/1.0 capability to the given Request. * @@ -105,20 +89,6 @@ public function addSurrogateCapability(Request $request) $request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new); } - /** - * Adds ESI/1.0 capability to the given Request. - * - * @param Request $request A Request instance - * - * @deprecated since version 2.6, to be removed in 3.0. Use addSurrogateCapability() instead - */ - public function addSurrogateEsiCapability(Request $request) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addSurrogateCapability() method instead.', E_USER_DEPRECATED); - - $this->addSurrogateCapability($request); - } - /** * Adds HTTP headers to specify that the Response needs to be parsed for ESI. * @@ -149,22 +119,6 @@ public function needsParsing(Response $response) return (bool) preg_match('#content="[^"]*ESI/1.0[^"]*"#', $control); } - /** - * Checks that the Response needs to be parsed for ESI tags. - * - * @param Response $response A Response instance - * - * @return bool true if the Response needs to be parsed, false otherwise - * - * @deprecated since version 2.6, to be removed in 3.0. Use needsParsing() instead - */ - public function needsEsiParsing(Response $response) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the needsParsing() method instead.', E_USER_DEPRECATED); - - return $this->needsParsing($response); - } - /** * Renders an ESI tag. * diff --git a/HttpCache/EsiResponseCacheStrategy.php b/HttpCache/EsiResponseCacheStrategy.php deleted file mode 100644 index 0d855464a3..0000000000 --- a/HttpCache/EsiResponseCacheStrategy.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategy class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategy class instead.', E_USER_DEPRECATED); - -/** - * EsiResponseCacheStrategy knows how to compute the Response cache HTTP header - * based on the different ESI response cache headers. - * - * This implementation changes the master response TTL to the smallest TTL received - * or force validation if one of the ESI has validation cache strategy. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategy instead - */ -class EsiResponseCacheStrategy extends ResponseCacheStrategy implements EsiResponseCacheStrategyInterface -{ -} diff --git a/HttpCache/EsiResponseCacheStrategyInterface.php b/HttpCache/EsiResponseCacheStrategyInterface.php deleted file mode 100644 index 22abb88639..0000000000 --- a/HttpCache/EsiResponseCacheStrategyInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategyInterface class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategyInterface class instead.', E_USER_DEPRECATED); - -/** - * ResponseCacheStrategyInterface implementations know how to compute the - * Response cache HTTP header based on the different response cache headers. - * - * @author Fabien Potencier - * - * @deprecated since version 2.6, to be removed in 3.0. Use ResponseCacheStrategyInterface instead. - */ -interface EsiResponseCacheStrategyInterface extends ResponseCacheStrategyInterface -{ -} diff --git a/HttpCache/HttpCache.php b/HttpCache/HttpCache.php index b6ccafc188..709366b7a9 100644 --- a/HttpCache/HttpCache.php +++ b/HttpCache/HttpCache.php @@ -156,6 +156,7 @@ public function getKernel() * Gets the Surrogate instance. * * @throws \LogicException + * * @return SurrogateInterface A Surrogate instance */ public function getSurrogate() @@ -163,26 +164,6 @@ public function getSurrogate() return $this->getEsi(); } - /** - * Gets the Esi instance. - * - * @throws \LogicException - * - * @return Esi An Esi instance - * - * @deprecated since version 2.6, to be removed in 3.0. Use getSurrogate() instead - */ - public function getEsi() - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED); - - if (!$this->surrogate instanceof Esi) { - throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate'); - } - - return $this->surrogate; - } - /** * {@inheritdoc} * diff --git a/Log/LoggerInterface.php b/Log/LoggerInterface.php deleted file mode 100644 index 737ba4e0f6..0000000000 --- a/Log/LoggerInterface.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -use Psr\Log\LoggerInterface as PsrLogger; - -/** - * LoggerInterface. - * - * @author Fabien Potencier - * - * @deprecated since version 2.2, to be removed in 3.0. Type-hint \Psr\Log\LoggerInterface instead. - * - * @api - */ -interface LoggerInterface extends PsrLogger -{ - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible. - */ - public function emerg($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible. - */ - public function crit($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible. - */ - public function err($message, array $context = array()); - - /** - * @api - * - * @deprecated since version 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible. - */ - public function warn($message, array $context = array()); -} diff --git a/Log/NullLogger.php b/Log/NullLogger.php deleted file mode 100644 index 915773b008..0000000000 --- a/Log/NullLogger.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -trigger_error('The '.__NAMESPACE__.'\NullLogger class is deprecated since version 2.2 and will be removed in 3.0. Use the Psr\Log\NullLogger class instead from the psr/log Composer package.', E_USER_DEPRECATED); - -use Psr\Log\NullLogger as PsrNullLogger; - -/** - * NullLogger. - * - * @author Fabien Potencier - * - * @api - */ -class NullLogger extends PsrNullLogger implements LoggerInterface -{ - /** - * @api - */ - public function emerg($message, array $context = array()) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function crit($message, array $context = array()) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function err($message, array $context = array()) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } - - /** - * @api - */ - public function warn($message, array $context = array()) - { - trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED); - } -} diff --git a/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php b/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php deleted file mode 100644 index 83182e63ea..0000000000 --- a/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class ContainerAwareHttpKernelTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getProviderTypes - */ - public function testHandle($type) - { - $request = new Request(); - $expected = new Response(); - $controller = function () use ($expected) { - return $expected; - }; - - $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $this - ->expectsEnterScopeOnce($container) - ->expectsLeaveScopeOnce($container) - ->expectsSetRequestWithAt($container, $request, 3) - ->expectsSetRequestWithAt($container, null, 4) - ; - - $dispatcher = new EventDispatcher(); - $resolver = $this->getResolverMockFor($controller, $request); - $stack = new RequestStack(); - $kernel = new ContainerAwareHttpKernel($dispatcher, $container, $resolver, $stack); - - $actual = $kernel->handle($request, $type); - - $this->assertSame($expected, $actual, '->handle() returns the response'); - } - - /** - * @dataProvider getProviderTypes - */ - public function testVerifyRequestStackPushPopDuringHandle($type) - { - $request = new Request(); - $expected = new Response(); - $controller = function () use ($expected) { - return $expected; - }; - - $stack = $this->getMock('Symfony\Component\HttpFoundation\RequestStack', array('push', 'pop')); - $stack->expects($this->at(0))->method('push')->with($this->equalTo($request)); - $stack->expects($this->at(1))->method('pop'); - - $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $dispatcher = new EventDispatcher(); - $resolver = $this->getResolverMockFor($controller, $request); - $kernel = new ContainerAwareHttpKernel($dispatcher, $container, $resolver, $stack); - - $kernel->handle($request, $type); - } - - /** - * @dataProvider getProviderTypes - */ - public function testHandleRestoresThePreviousRequestOnException($type) - { - $request = new Request(); - $expected = new \Exception(); - $controller = function () use ($expected) { - throw $expected; - }; - - $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $this - ->expectsEnterScopeOnce($container) - ->expectsLeaveScopeOnce($container) - ->expectsSetRequestWithAt($container, $request, 3) - ->expectsSetRequestWithAt($container, null, 4) - ; - - $dispatcher = new EventDispatcher(); - $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); - $resolver = $this->getResolverMockFor($controller, $request); - $stack = new RequestStack(); - $kernel = new ContainerAwareHttpKernel($dispatcher, $container, $resolver, $stack); - - try { - $kernel->handle($request, $type); - $this->fail('->handle() suppresses the controller exception'); - } catch (\PHPUnit_Framework_Exception $exception) { - throw $exception; - } catch (\Exception $actual) { - $this->assertSame($expected, $actual, '->handle() throws the controller exception'); - } - } - - public function getProviderTypes() - { - return array( - array(HttpKernelInterface::MASTER_REQUEST), - array(HttpKernelInterface::SUB_REQUEST), - ); - } - - private function getResolverMockFor($controller, $request) - { - $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); - $resolver->expects($this->once()) - ->method('getController') - ->with($request) - ->will($this->returnValue($controller)); - $resolver->expects($this->once()) - ->method('getArguments') - ->with($request, $controller) - ->will($this->returnValue(array())); - - return $resolver; - } - - private function expectsSetRequestWithAt($container, $with, $at) - { - $container - ->expects($this->at($at)) - ->method('set') - ->with($this->equalTo('request'), $this->equalTo($with), $this->equalTo('request')) - ; - - return $this; - } - - private function expectsEnterScopeOnce($container) - { - $container - ->expects($this->once()) - ->method('enterScope') - ->with($this->equalTo('request')) - ; - - return $this; - } - - private function expectsLeaveScopeOnce($container) - { - $container - ->expects($this->once()) - ->method('leaveScope') - ->with($this->equalTo('request')) - ; - - return $this; - } -} diff --git a/Tests/DependencyInjection/FragmentRendererPassTest.php b/Tests/DependencyInjection/FragmentRendererPassTest.php index a46a07cf1d..98266e9400 100644 --- a/Tests/DependencyInjection/FragmentRendererPassTest.php +++ b/Tests/DependencyInjection/FragmentRendererPassTest.php @@ -11,63 +11,12 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass; use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; class FragmentRendererPassTest extends \PHPUnit_Framework_TestCase { - /** - * @group legacy - */ - public function testLegacyFragmentRedererWithoutAlias() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - // no alias - $services = array( - 'my_content_renderer' => array(array()), - ); - - $renderer = $this->getMock('Symfony\Component\DependencyInjection\Definition'); - $renderer - ->expects($this->once()) - ->method('addMethodCall') - ->with('addRenderer', array(new Reference('my_content_renderer'))) - ; - - $definition = $this->getMock('Symfony\Component\DependencyInjection\Definition'); - $definition->expects($this->atLeastOnce()) - ->method('getClass') - ->will($this->returnValue('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService')); - $definition - ->expects($this->once()) - ->method('isPublic') - ->will($this->returnValue(true)) - ; - - $builder = $this->getMock( - 'Symfony\Component\DependencyInjection\ContainerBuilder', - array('hasDefinition', 'findTaggedServiceIds', 'getDefinition') - ); - $builder->expects($this->any()) - ->method('hasDefinition') - ->will($this->returnValue(true)); - - // We don't test kernel.fragment_renderer here - $builder->expects($this->atLeastOnce()) - ->method('findTaggedServiceIds') - ->will($this->returnValue($services)); - - $builder->expects($this->atLeastOnce()) - ->method('getDefinition') - ->will($this->onConsecutiveCalls($renderer, $definition)); - - $pass = new FragmentRendererPass(); - $pass->process($builder); - } - /** * Tests that content rendering not implementing FragmentRendererInterface * trigger an exception. diff --git a/Tests/EventListener/ProfilerListenerTest.php b/Tests/EventListener/ProfilerListenerTest.php index 605ea9dd24..b8a4fdd04c 100644 --- a/Tests/EventListener/ProfilerListenerTest.php +++ b/Tests/EventListener/ProfilerListenerTest.php @@ -14,7 +14,6 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -22,42 +21,6 @@ class ProfilerListenerTest extends \PHPUnit_Framework_TestCase { - /** - * Test to ensure BC without RequestStack - * - * @group legacy - */ - public function testLegacyEventsWithoutRequestStack() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') - ->disableOriginalConstructor() - ->getMock(); - - $profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler') - ->disableOriginalConstructor() - ->getMock(); - $profiler->expects($this->once()) - ->method('collect') - ->will($this->returnValue($profile)); - - $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); - - $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') - ->disableOriginalConstructor() - ->getMock(); - - $response = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response') - ->disableOriginalConstructor() - ->getMock(); - - $listener = new ProfilerListener($profiler); - $listener->onKernelRequest(new GetResponseEvent($kernel, $request, Kernel::MASTER_REQUEST)); - $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, Kernel::MASTER_REQUEST, $response)); - $listener->onKernelTerminate(new PostResponseEvent($kernel, $request, $response)); - } - /** * Test a master and sub request with an exception and `onlyException` profiler option enabled. */ diff --git a/Tests/Logger.php b/Tests/Logger.php index 017518a305..63c70bf67a 100644 --- a/Tests/Logger.php +++ b/Tests/Logger.php @@ -85,44 +85,4 @@ public function debug($message, array $context = array()) { $this->log('debug', $message, $context); } - - /** - * @deprecated - */ - public function emerg($message, array $context = array()) - { - trigger_error('Use emergency() which is PSR-3 compatible', E_USER_DEPRECATED); - - $this->log('emergency', $message, $context); - } - - /** - * @deprecated - */ - public function crit($message, array $context = array()) - { - trigger_error('Use critical() which is PSR-3 compatible', E_USER_DEPRECATED); - - $this->log('critical', $message, $context); - } - - /** - * @deprecated - */ - public function err($message, array $context = array()) - { - trigger_error('Use error() which is PSR-3 compatible', E_USER_DEPRECATED); - - $this->log('error', $message, $context); - } - - /** - * @deprecated - */ - public function warn($message, array $context = array()) - { - trigger_error('Use warning() which is PSR-3 compatible', E_USER_DEPRECATED); - - $this->log('warning', $message, $context); - } }