Skip to content

Commit 660d79a

Browse files
author
Denis Brumann
committed
Deprecates ClassCache-cache warmer.
1 parent 51bc35c commit 660d79a

File tree

17 files changed

+202
-115
lines changed

17 files changed

+202
-115
lines changed

src/Symfony/Bridge/Twig/Form/TwigRendererEngineInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*
19-
* @deprecated Deprecated since version 3.2, to be removed in 4.0.
19+
* @deprecated since version 3.2, to be removed in 4.0.
2020
*/
2121
interface TwigRendererEngineInterface extends FormRendererEngineInterface
2222
{

src/Symfony/Bridge/Twig/Form/TwigRendererInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @author Bernhard Schussek <bschussek@gmail.com>
1818
*
19-
* @deprecated Deprecated since version 3.2, to be removed in 4.0.
19+
* @deprecated since version 3.2, to be removed in 4.0.
2020
*/
2121
interface TwigRendererInterface extends FormRendererInterface
2222
{

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ClassCacheCacheWarmer.php

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

1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

14+
if (PHP_VERSION_ID >= 70000) {
15+
@trigger_error('The '.__NAMESPACE__.'\ClassCacheCacheWarmer class is deprecated since version 3.3 and will be removed in 4.0.', E_USER_DEPRECATED);
16+
}
17+
1418
use Symfony\Component\ClassLoader\ClassCollectionLoader;
1519
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1620

1721
/**
1822
* Generates the Class Cache (classes.php) file.
1923
*
2024
* @author Tugdual Saunier <tucksaun@gmail.com>
25+
*
26+
* @deprecated since version 3.3, to be removed in 4.0.
2127
*/
2228
class ClassCacheCacheWarmer implements CacheWarmerInterface
2329
{

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 102 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public function load(array $configs, ContainerBuilder $container)
7171

7272
$loader->load('web.xml');
7373
$loader->load('services.xml');
74+
75+
if (PHP_VERSION_ID < 70000) {
76+
$definition = $container->getDefinition('kernel.class_cache.cache_warmer');
77+
$definition->addTag('kernel.cache_warmer');
78+
// Ignore deprecation for PHP versions below 7.0
79+
$definition->setDeprecated(false);
80+
}
81+
7482
$loader->load('fragment_renderer.xml');
7583

7684
// Property access is used by both the Form and the Validator component
@@ -194,47 +202,49 @@ public function load(array $configs, ContainerBuilder $container)
194202
'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller',
195203
));
196204

197-
$this->addClassesToCompile(array(
198-
'Symfony\\Component\\Config\\ConfigCache',
199-
'Symfony\\Component\\Config\\FileLocator',
200-
201-
'Symfony\\Component\\Debug\\ErrorHandler',
202-
203-
'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface',
204-
'Symfony\\Component\\DependencyInjection\\Container',
205-
206-
'Symfony\\Component\\EventDispatcher\\Event',
207-
'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher',
208-
209-
'Symfony\\Component\\HttpFoundation\\Response',
210-
'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag',
211-
212-
'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener',
213-
'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener',
214-
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
215-
'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver',
216-
'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver',
217-
'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata',
218-
'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactory',
219-
'Symfony\\Component\\HttpKernel\\Event\\KernelEvent',
220-
'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent',
221-
'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent',
222-
'Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent',
223-
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent',
224-
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent',
225-
'Symfony\\Component\\HttpKernel\\HttpKernel',
226-
'Symfony\\Component\\HttpKernel\\KernelEvents',
227-
'Symfony\\Component\\HttpKernel\\Config\\FileLocator',
228-
229-
'Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerNameParser',
230-
'Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver',
231-
232-
// Cannot be included because annotations will parse the big compiled class file
233-
// 'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller',
234-
235-
// cannot be included as commands are discovered based on the path to this class via Reflection
236-
// 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
237-
));
205+
if (PHP_VERSION_ID < 70000) {
206+
$this->addClassesToCompile(array(
207+
'Symfony\\Component\\Config\\ConfigCache',
208+
'Symfony\\Component\\Config\\FileLocator',
209+
210+
'Symfony\\Component\\Debug\\ErrorHandler',
211+
212+
'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface',
213+
'Symfony\\Component\\DependencyInjection\\Container',
214+
215+
'Symfony\\Component\\EventDispatcher\\Event',
216+
'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher',
217+
218+
'Symfony\\Component\\HttpFoundation\\Response',
219+
'Symfony\\Component\\HttpFoundation\\ResponseHeaderBag',
220+
221+
'Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener',
222+
'Symfony\\Component\\HttpKernel\\EventListener\\RouterListener',
223+
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
224+
'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver',
225+
'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver',
226+
'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata',
227+
'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactory',
228+
'Symfony\\Component\\HttpKernel\\Event\\KernelEvent',
229+
'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent',
230+
'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent',
231+
'Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent',
232+
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent',
233+
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent',
234+
'Symfony\\Component\\HttpKernel\\HttpKernel',
235+
'Symfony\\Component\\HttpKernel\\KernelEvents',
236+
'Symfony\\Component\\HttpKernel\\Config\\FileLocator',
237+
238+
'Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerNameParser',
239+
'Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver',
240+
241+
// Cannot be included because annotations will parse the big compiled class file
242+
// 'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller',
243+
244+
// cannot be included as commands are discovered based on the path to this class via Reflection
245+
// 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
246+
));
247+
}
238248
}
239249

240250
/**
@@ -525,13 +535,15 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
525535
$container->setParameter('request_listener.http_port', $config['http_port']);
526536
$container->setParameter('request_listener.https_port', $config['https_port']);
527537

528-
$this->addClassesToCompile(array(
529-
'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
530-
'Symfony\\Component\\Routing\\RequestContext',
531-
'Symfony\\Component\\Routing\\Router',
532-
'Symfony\\Bundle\\FrameworkBundle\\Routing\\RedirectableUrlMatcher',
533-
$container->findDefinition('router.default')->getClass(),
534-
));
538+
if (PHP_VERSION_ID < 70000) {
539+
$this->addClassesToCompile(array(
540+
'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
541+
'Symfony\\Component\\Routing\\RequestContext',
542+
'Symfony\\Component\\Routing\\Router',
543+
'Symfony\\Bundle\\FrameworkBundle\\Routing\\RedirectableUrlMatcher',
544+
$container->findDefinition('router.default')->getClass(),
545+
));
546+
}
535547
}
536548

537549
/**
@@ -574,20 +586,22 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
574586

575587
$container->setParameter('session.save_path', $config['save_path']);
576588

577-
$this->addClassesToCompile(array(
578-
'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener',
579-
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage',
580-
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage',
581-
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler',
582-
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy',
583-
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy',
584-
$container->getDefinition('session')->getClass(),
585-
));
586-
587-
if ($container->hasDefinition($config['storage_id'])) {
589+
if (PHP_VERSION_ID < 70000) {
588590
$this->addClassesToCompile(array(
589-
$container->findDefinition('session.storage')->getClass(),
591+
'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener',
592+
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage',
593+
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpBridgeSessionStorage',
594+
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler',
595+
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy',
596+
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy',
597+
$container->getDefinition('session')->getClass(),
590598
));
599+
600+
if ($container->hasDefinition($config['storage_id'])) {
601+
$this->addClassesToCompile(array(
602+
$container->findDefinition('session.storage')->getClass(),
603+
));
604+
}
591605
}
592606

593607
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
@@ -657,12 +671,14 @@ private function registerTemplatingConfiguration(array $config, ContainerBuilder
657671
$container->setDefinition('templating.loader', $loaderCache);
658672
}
659673

660-
$this->addClassesToCompile(array(
661-
'Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables',
662-
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference',
663-
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser',
664-
$container->findDefinition('templating.locator')->getClass(),
665-
));
674+
if (PHP_VERSION_ID < 70000) {
675+
$this->addClassesToCompile(array(
676+
'Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables',
677+
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference',
678+
'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser',
679+
$container->findDefinition('templating.locator')->getClass(),
680+
));
681+
}
666682

667683
$container->setParameter('templating.engines', $config['engines']);
668684
$engines = array_map(function ($engine) { return new Reference('templating.engine.'.$engine); }, $config['engines']);
@@ -695,11 +711,13 @@ private function registerTemplatingConfiguration(array $config, ContainerBuilder
695711
$container->setAlias('debug.templating.engine.php', 'templating.engine.php');
696712
}
697713

698-
$this->addClassesToCompile(array(
699-
'Symfony\\Component\\Templating\\Storage\\FileStorage',
700-
'Symfony\\Bundle\\FrameworkBundle\\Templating\\PhpEngine',
701-
'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader',
702-
));
714+
if (PHP_VERSION_ID < 70000) {
715+
$this->addClassesToCompile(array(
716+
'Symfony\\Component\\Templating\\Storage\\FileStorage',
717+
'Symfony\\Bundle\\FrameworkBundle\\Templating\\PhpEngine',
718+
'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader',
719+
));
720+
}
703721

704722
if ($container->has('assets.packages')) {
705723
$container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages'));
@@ -1015,10 +1033,12 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
10151033
$definition = $container->findDefinition('annotations.cache_warmer');
10161034
$definition->addTag('kernel.cache_warmer');
10171035

1018-
$this->addClassesToCompile(array(
1019-
'Symfony\Component\Cache\Adapter\PhpArrayAdapter',
1020-
'Symfony\Component\Cache\DoctrineProvider',
1021-
));
1036+
if (PHP_VERSION_ID < 70000) {
1037+
$this->addClassesToCompile(array(
1038+
'Symfony\Component\Cache\Adapter\PhpArrayAdapter',
1039+
'Symfony\Component\Cache\DoctrineProvider',
1040+
));
1041+
}
10221042
} elseif ('file' === $config['cache']) {
10231043
$cacheDir = $container->getParameterBag()->resolveValue($config['file_cache_dir']);
10241044

@@ -1270,11 +1290,13 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
12701290
$propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache'));
12711291
}
12721292

1273-
$this->addClassesToCompile(array(
1274-
'Symfony\Component\Cache\Adapter\ApcuAdapter',
1275-
'Symfony\Component\Cache\Adapter\FilesystemAdapter',
1276-
'Symfony\Component\Cache\CacheItem',
1277-
));
1293+
if (PHP_VERSION_ID < 70000) {
1294+
$this->addClassesToCompile(array(
1295+
'Symfony\Component\Cache\Adapter\ApcuAdapter',
1296+
'Symfony\Component\Cache\Adapter\FilesystemAdapter',
1297+
'Symfony\Component\Cache\CacheItem',
1298+
));
1299+
}
12781300
}
12791301

12801302
/**

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@
2525
</service>
2626

2727
<service id="kernel.class_cache.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\ClassCacheCacheWarmer">
28-
<tag name="kernel.cache_warmer" />
2928
<argument type="collection">
3029
<argument>Symfony\Component\HttpFoundation\ParameterBag</argument>
3130
<argument>Symfony\Component\HttpFoundation\HeaderBag</argument>
3231
<argument>Symfony\Component\HttpFoundation\FileBag</argument>
3332
<argument>Symfony\Component\HttpFoundation\ServerBag</argument>
3433
<argument>Symfony\Component\HttpFoundation\Request</argument>
3534
<argument>Symfony\Component\HttpKernel\Kernel</argument>
36-
<argument>Symfony\Component\ClassLoader\ClassCollectionLoader</argument>
3735
</argument>
36+
<deprecated>The "%service_id%" option is deprecated since version 3.3, to be removed in 4.0.</deprecated>
3837
</service>
3938

4039
<service id="cache_clearer" class="Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer">

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ClassCacheCacheWarmerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\WarmedClass;
1717
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class ClassCacheCacheWarmerTest extends TestCase
2023
{
2124
public function testWithDeclaredClasses()

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,22 @@ public function load(array $configs, ContainerBuilder $container)
101101
$this->aclLoad($config['acl'], $container);
102102
}
103103

104-
// add some required classes for compilation
105-
$this->addClassesToCompile(array(
106-
'Symfony\Component\Security\Http\Firewall',
107-
'Symfony\Component\Security\Core\User\UserProviderInterface',
108-
'Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager',
109-
'Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage',
110-
'Symfony\Component\Security\Core\Authorization\AccessDecisionManager',
111-
'Symfony\Component\Security\Core\Authorization\AuthorizationChecker',
112-
'Symfony\Component\Security\Core\Authorization\Voter\VoterInterface',
113-
'Symfony\Bundle\SecurityBundle\Security\FirewallConfig',
114-
'Symfony\Bundle\SecurityBundle\Security\FirewallMap',
115-
'Symfony\Bundle\SecurityBundle\Security\FirewallContext',
116-
'Symfony\Component\HttpFoundation\RequestMatcher',
117-
));
104+
if (PHP_VERSION_ID < 70000) {
105+
// add some required classes for compilation
106+
$this->addClassesToCompile(array(
107+
'Symfony\Component\Security\Http\Firewall',
108+
'Symfony\Component\Security\Core\User\UserProviderInterface',
109+
'Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager',
110+
'Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage',
111+
'Symfony\Component\Security\Core\Authorization\AccessDecisionManager',
112+
'Symfony\Component\Security\Core\Authorization\AuthorizationChecker',
113+
'Symfony\Component\Security\Core\Authorization\Voter\VoterInterface',
114+
'Symfony\Bundle\SecurityBundle\Security\FirewallConfig',
115+
'Symfony\Bundle\SecurityBundle\Security\FirewallMap',
116+
'Symfony\Bundle\SecurityBundle\Security\FirewallContext',
117+
'Symfony\Component\HttpFoundation\RequestMatcher',
118+
));
119+
}
118120
}
119121

120122
private function aclLoad($config, ContainerBuilder $container)
@@ -191,9 +193,11 @@ private function createAuthorization($config, ContainerBuilder $container)
191193
return;
192194
}
193195

194-
$this->addClassesToCompile(array(
195-
'Symfony\\Component\\Security\\Http\\AccessMap',
196-
));
196+
if (PHP_VERSION_ID < 70000) {
197+
$this->addClassesToCompile(array(
198+
'Symfony\\Component\\Security\\Http\\AccessMap',
199+
));
200+
}
197201

198202
foreach ($config['access_control'] as $access) {
199203
$matcher = $this->createRequestMatcher(

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,18 @@ public function load(array $configs, ContainerBuilder $container)
126126

127127
$container->getDefinition('twig')->replaceArgument(1, $config);
128128

129-
$this->addClassesToCompile(array(
130-
'Twig_Environment',
131-
'Twig_Extension',
132-
'Twig_Extension_Core',
133-
'Twig_Extension_Escaper',
134-
'Twig_Extension_Optimizer',
135-
'Twig_LoaderInterface',
136-
'Twig_Markup',
137-
'Twig_Template',
138-
));
129+
if (PHP_VERSION_ID < 70000) {
130+
$this->addClassesToCompile(array(
131+
'Twig_Environment',
132+
'Twig_Extension',
133+
'Twig_Extension_Core',
134+
'Twig_Extension_Escaper',
135+
'Twig_Extension_Optimizer',
136+
'Twig_LoaderInterface',
137+
'Twig_Markup',
138+
'Twig_Template',
139+
));
140+
}
139141
}
140142

141143
private function addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle)

0 commit comments

Comments
 (0)