Skip to content

Commit d7dcaee

Browse files
author
Denis Brumann
committed
Deprecates ClassCache-cache warmer.
1 parent 01e72a5 commit d7dcaee

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

DataCollector/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function cloneVar($var)
9898
*
9999
* @return string The string representation of the variable
100100
*
101-
* @deprecated Deprecated since version 3.2, to be removed in 4.0. Use cloneVar() instead.
101+
* @deprecated since version 3.2, to be removed in 4.0. Use cloneVar() instead.
102102
*/
103103
protected function varToString($var)
104104
{

DependencyInjection/AddClassesToCachePass.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
namespace Symfony\Component\HttpKernel\DependencyInjection;
1313

14+
if (PHP_VERSION_ID >= 70000) {
15+
@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since version 3.3 and will be removed in 4.0.', E_USER_DEPRECATED);
16+
}
17+
1418
use Composer\Autoload\ClassLoader;
1519
use Symfony\Component\Debug\DebugClassLoader;
1620
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,6 +25,8 @@
2125
* Sets the classes to compile in the cache for the container.
2226
*
2327
* @author Fabien Potencier <fabien@symfony.com>
28+
*
29+
* @deprecated since version 3.3, to be removed in 4.0.
2430
*/
2531
class AddClassesToCachePass implements CompilerPassInterface
2632
{

DependencyInjection/Extension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ public function getAnnotatedClassesToCompile()
4747
* Adds classes to the class cache.
4848
*
4949
* @param array $classes An array of class patterns
50+
*
51+
* @deprecated since version 3.3, to be removed in 4.0.
5052
*/
5153
public function addClassesToCompile(array $classes)
5254
{
55+
if (PHP_VERSION_ID >= 70000) {
56+
@trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
57+
}
58+
5359
$this->classes = array_merge($this->classes, $classes);
5460
}
5561

Kernel.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,29 @@ public function getContainer()
321321
*
322322
* @param string $name The cache name prefix
323323
* @param string $extension File extension of the resulting file
324+
*
325+
* @deprecated since version 3.3, to be removed in 4.0.
324326
*/
325327
public function loadClassCache($name = 'classes', $extension = '.php')
326328
{
329+
if (PHP_VERSION_ID >= 70000) {
330+
@trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
331+
}
332+
327333
$this->loadClassCache = array($name, $extension);
328334
}
329335

330336
/**
331337
* @internal
338+
*
339+
* @deprecated since version 3.3, to be removed in 4.0.
332340
*/
333341
public function setClassCache(array $classes)
334342
{
343+
if (PHP_VERSION_ID >= 70000) {
344+
@trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
345+
}
346+
335347
file_put_contents($this->getCacheDir().'/classes.map', sprintf('<?php return %s;', var_export($classes, true)));
336348
}
337349

@@ -375,8 +387,15 @@ public function getCharset()
375387
return 'UTF-8';
376388
}
377389

390+
/**
391+
* @deprecated since version 3.3, to be removed in 4.0.
392+
*/
378393
protected function doLoadClassCache($name, $extension)
379394
{
395+
if (PHP_VERSION_ID >= 70000) {
396+
@trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
397+
}
398+
380399
if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) {
381400
ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension);
382401
}
@@ -571,7 +590,9 @@ protected function buildContainer()
571590
$container->merge($cont);
572591
}
573592

574-
$container->addCompilerPass(new AddClassesToCachePass($this));
593+
if (PHP_VERSION_ID < 70000) {
594+
$container->addCompilerPass(new AddClassesToCachePass($this));
595+
}
575596
$container->addResource(new EnvParametersResource('SYMFONY__'));
576597

577598
return $container;

Tests/DependencyInjection/AddClassesToCachePassTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class AddClassesToCachePassTest extends \PHPUnit_Framework_TestCase
1720
{
1821
public function testExpandClasses()

Tests/KernelTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public function testBootSetsTheBootedFlagToTrue()
8585
$this->assertTrue($kernel->isBooted());
8686
}
8787

88+
/**
89+
* @group legacy
90+
*/
8891
public function testClassCacheIsLoaded()
8992
{
9093
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
@@ -105,6 +108,9 @@ public function testClassCacheIsNotLoadedByDefault()
105108
$kernel->boot();
106109
}
107110

111+
/**
112+
* @group legacy
113+
*/
108114
public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
109115
{
110116
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));

0 commit comments

Comments
 (0)