Skip to content

Commit a19c120

Browse files
committed
feature symfony#23569 Remove last legacy codes (nicolas-grekas)
This PR was merged into the 4.0-dev branch. Discussion ---------- Remove last legacy codes | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 86ec5e1 Remove last legacy codes
2 parents 4b30b6e + 86ec5e1 commit a19c120

File tree

6 files changed

+12
-44
lines changed

6 files changed

+12
-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-
* @final since version 3.4, type-hint to 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: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,12 @@
2626
*/
2727
class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
2828
{
29-
protected $router;
29+
private $container;
3030

31-
/**
32-
* Constructor.
33-
*
34-
* @param ContainerInterface $container
35-
*/
36-
public function __construct($container)
31+
public function __construct(ContainerInterface $container)
3732
{
3833
// As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
39-
if ($container instanceof ContainerInterface) {
40-
$this->router = $container->get('router'); // For BC, the $router property must be populated in the constructor
41-
} elseif ($container instanceof RouterInterface) {
42-
$this->router = $container;
43-
@trigger_error(sprintf('Using a "%s" as first argument of %s is deprecated since version 3.4 and will be unsupported in version 4.0. Use a %s instead.', RouterInterface::class, __CLASS__, ContainerInterface::class), E_USER_DEPRECATED);
44-
} else {
45-
throw new \InvalidArgumentException(sprintf('%s only accepts instance of Psr\Container\ContainerInterface as first argument.', __CLASS__));
46-
}
34+
$this->container = $container;
4735
}
4836

4937
/**
@@ -53,8 +41,10 @@ public function __construct($container)
5341
*/
5442
public function warmUp($cacheDir)
5543
{
56-
if ($this->router instanceof WarmableInterface) {
57-
$this->router->warmUp($cacheDir);
44+
$router = $this->container->get('router');
45+
46+
if ($router instanceof WarmableInterface) {
47+
$router->warmUp($cacheDir);
5848
}
5949
}
6050

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/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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ 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
34+
if (in_array($id, $knownPrivates, true)) { // for BC with 3.4
3535
continue;
3636
}
3737
try {

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)