Skip to content

Commit cb96b54

Browse files
committed
trigger deprecation notices for deprecated code
1 parent f7648ad commit cb96b54

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

CacheManager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public function setGenerateUrlType($generateUrlType)
7272
*/
7373
public function tagResponse(Response $response, array $tags, $replace = false)
7474
{
75+
@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);
76+
7577
if (!$replace && $response->headers->has($this->getTagsHeader())) {
7678
$header = $response->headers->get($this->getTagsHeader());
7779
if ('' !== $header) {

Command/InvalidateTagCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public function __construct($tagHandler = null, $commandName = 'fos:httpcache:in
5454
)
5555
);
5656
}
57+
if ($tagHandler instanceof CacheManager) {
58+
@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);
59+
60+
}
5761
$this->commandName = $commandName;
5862
$this->tagHandler = $tagHandler;
5963
parent::__construct();

HttpCache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
use Symfony\Component\HttpFoundation\Request;
2121
use Symfony\Component\HttpKernel\HttpKernelInterface;
2222

23+
@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);
24+
2325
/**
2426
* Base class for enhanced Symfony reverse proxy based on the symfony FrameworkBundle HttpCache.
2527
*

Tests/Unit/CacheManagerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public function testRefreshRoute()
8080
;
8181
}
8282

83+
/**
84+
* @group legacy
85+
*/
8386
public function testTagResponse()
8487
{
8588
$ban = \Mockery::mock('\FOS\HttpCache\ProxyClient\Invalidation\BanInterface');

Tests/Unit/HttpCacheTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\HttpKernelInterface;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class HttpCacheTest extends \PHPUnit_Framework_TestCase
2023
{
2124
/**

0 commit comments

Comments
 (0)