Skip to content

Commit 3fbce8f

Browse files
Remove last legacy codes
1 parent aac9273 commit 3fbce8f

File tree

7 files changed

+29
-44
lines changed

7 files changed

+29
-44
lines changed

src/Symfony/Bridge/Twig/Extension/RoutingExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public function getUrl($name, $parameters = array(), $schemeRelative = false)
9191
*
9292
* @return array An array with the contexts the URL is safe
9393
*
94-
* To be made @final in 3.4, and the type-hint be changed to "\Twig\Node\Node" in 4.0.
94+
* @final since version 3.4
9595
*/
96-
public function isUrlGenerationSafe(\Twig_Node $argsNode)
96+
public function isUrlGenerationSafe(Node $argsNode)
9797
{
9898
// support named arguments
9999
$paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : (

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

14+
use Psr\Container\ContainerInterface;
1415
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1516
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
1617
use Symfony\Component\Routing\RouterInterface;
@@ -20,20 +21,16 @@
2021
*
2122
* @author Fabien Potencier <fabien@symfony.com>
2223
*
23-
* @final since version 3.4, to be given a container instead in 4.0
24+
* @final since version 3.4
2425
*/
25-
class RouterCacheWarmer implements CacheWarmerInterface
26+
class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
2627
{
27-
protected $router;
28+
private $container;
2829

29-
/**
30-
* Constructor.
31-
*
32-
* @param RouterInterface $router A Router instance
33-
*/
34-
public function __construct(RouterInterface $router)
30+
public function __construct(ContainerInterface $container)
3531
{
36-
$this->router = $router;
32+
// As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
33+
$this->container = $container;
3734
}
3835

3936
/**
@@ -43,8 +40,10 @@ public function __construct(RouterInterface $router)
4340
*/
4441
public function warmUp($cacheDir)
4542
{
46-
if ($this->router instanceof WarmableInterface) {
47-
$this->router->warmUp($cacheDir);
43+
$router = $this->container->get('router');
44+
45+
if ($router instanceof WarmableInterface) {
46+
$router->warmUp($cacheDir);
4847
}
4948
}
5049

@@ -57,4 +56,14 @@ public function isOptional()
5756
{
5857
return true;
5958
}
59+
60+
/**
61+
* {@inheritdoc}
62+
*/
63+
public static function getSubscribedServices()
64+
{
65+
return array(
66+
'router' => RouterInterface::class,
67+
);
68+
}
6069
}

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -629,18 +629,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
629629
->info('validation configuration')
630630
->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
631631
->children()
632-
->scalarNode('cache')
633-
->beforeNormalization()
634-
// Can be removed in 4.0, when validator.mapping.cache.doctrine.apc is removed
635-
->ifString()->then(function ($v) {
636-
if ('validator.mapping.cache.doctrine.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) {
637-
throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.');
638-
}
639-
640-
return $v;
641-
})
642-
->end()
643-
->end()
632+
->scalarNode('cache')->end()
644633
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
645634
->arrayNode('static_method')
646635
->defaultValue(array('loadValidatorMetadata'))

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@
8989
<service id="Symfony\Component\Routing\RequestContext" alias="router.request_context" />
9090

9191
<service id="router.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer">
92+
<tag name="container.service_subscriber" id="router" />
9293
<tag name="kernel.cache_warmer" />
93-
<argument type="service" id="router" />
94+
<argument type="service" id="Psr\Container\ContainerInterface" />
9495
</service>
9596

9697
<service id="router_listener" class="Symfony\Component\HttpKernel\EventListener\RouterListener" public="true">

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,6 @@
4949
</argument>
5050
</service>
5151

52-
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache">
53-
<argument type="service">
54-
<service class="Doctrine\Common\Cache\ApcCache">
55-
<call method="setNamespace">
56-
<argument>%validator.mapping.cache.prefix%</argument>
57-
</call>
58-
</service>
59-
</argument>
60-
<deprecated>The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use a Psr6 cache like "validator.mapping.cache.symfony" instead.</deprecated>
61-
</service>
62-
6352
<service id="validator.validator_factory" class="Symfony\Component\Validator\ContainerConstraintValidatorFactory">
6453
<argument /> <!-- Constraint validators locator -->
6554
</service>

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ class WebProfilerExtensionTest extends TestCase
2727
*/
2828
private $container;
2929

30-
public static function assertSaneContainer(Container $container, $message = '', $knownPrivates = array())
30+
public static function assertSaneContainer(Container $container, $message = '')
3131
{
3232
$errors = array();
3333
foreach ($container->getServiceIds() as $id) {
34-
if (in_array($id, $knownPrivates, true)) { // to be removed in 4.0
35-
continue;
36-
}
3734
try {
3835
$container->get($id);
3936
} catch (\Exception $e) {
@@ -101,7 +98,7 @@ public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listene
10198

10299
$this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
103100

104-
$this->assertSaneContainer($this->getDumpedContainer(), '', array('web_profiler.csp.handler'));
101+
$this->assertSaneContainer($this->getDumpedContainer());
105102

106103
if ($listenerInjected) {
107104
$this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());

src/Symfony/Component/Form/FormInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function addError(FormError $error);
189189
/**
190190
* Returns whether the form and all children are valid.
191191
*
192-
* If the form is not submitted, this method always returns false (but will throw an exception in 4.0).
192+
* @throws Exception\LogicException If the form is not submitted.
193193
*
194194
* @return bool
195195
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy