From cb96b54725d0871c064269b6be93424fc577d1f8 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 17 Feb 2016 11:17:14 +0100 Subject: [PATCH] trigger deprecation notices for deprecated code --- CacheManager.php | 2 ++ Command/InvalidateTagCommand.php | 4 ++++ HttpCache.php | 2 ++ Tests/Unit/CacheManagerTest.php | 3 +++ Tests/Unit/HttpCacheTest.php | 3 +++ 5 files changed, 14 insertions(+) diff --git a/CacheManager.php b/CacheManager.php index 91f8b9d5..35c8eaae 100644 --- a/CacheManager.php +++ b/CacheManager.php @@ -72,6 +72,8 @@ public function setGenerateUrlType($generateUrlType) */ public function tagResponse(Response $response, array $tags, $replace = false) { + @trigger_error('The '.__METHOD__.' method is deprecated since version 1.2 and will be removed in 2.0. Use the TagHandler instead.', E_USER_DEPRECATED); + if (!$replace && $response->headers->has($this->getTagsHeader())) { $header = $response->headers->get($this->getTagsHeader()); if ('' !== $header) { diff --git a/Command/InvalidateTagCommand.php b/Command/InvalidateTagCommand.php index 91202ef5..71e09dca 100644 --- a/Command/InvalidateTagCommand.php +++ b/Command/InvalidateTagCommand.php @@ -54,6 +54,10 @@ public function __construct($tagHandler = null, $commandName = 'fos:httpcache:in ) ); } + if ($tagHandler instanceof CacheManager) { + @trigger_error('Passing the CacheManager to '.__CLASS__.' is deprecated since version 1.2 and will be removed in 2.0. Provide the TagHandler instead.', E_USER_DEPRECATED); + + } $this->commandName = $commandName; $this->tagHandler = $tagHandler; parent::__construct(); diff --git a/HttpCache.php b/HttpCache.php index 94229f7f..7257449d 100644 --- a/HttpCache.php +++ b/HttpCache.php @@ -20,6 +20,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; +@trigger_error('The '.__NAMESPACE__.'\HttpCache class is deprecated since version 1.2 and will be removed in 2.0. Use FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache instead.', E_USER_DEPRECATED); + /** * Base class for enhanced Symfony reverse proxy based on the symfony FrameworkBundle HttpCache. * diff --git a/Tests/Unit/CacheManagerTest.php b/Tests/Unit/CacheManagerTest.php index a1dd9895..a3ccd5de 100644 --- a/Tests/Unit/CacheManagerTest.php +++ b/Tests/Unit/CacheManagerTest.php @@ -80,6 +80,9 @@ public function testRefreshRoute() ; } + /** + * @group legacy + */ public function testTagResponse() { $ban = \Mockery::mock('\FOS\HttpCache\ProxyClient\Invalidation\BanInterface'); diff --git a/Tests/Unit/HttpCacheTest.php b/Tests/Unit/HttpCacheTest.php index 3cc56483..373adcc9 100644 --- a/Tests/Unit/HttpCacheTest.php +++ b/Tests/Unit/HttpCacheTest.php @@ -16,6 +16,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelInterface; +/** + * @group legacy + */ class HttpCacheTest extends \PHPUnit_Framework_TestCase { /**