8000 minor #31951 [DI] remove deprecated code paths (nicolas-grekas) · symfony/symfony@ceb40c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ceb40c1

Browse files
minor #31951 [DI] remove deprecated code paths (nicolas-grekas)
This PR was merged into the 5.0-dev branch. Discussion ---------- [DI] remove deprecated code paths | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - @ro0NL there is still one legacy test in ValidateEnvPlaceholdersPassTest, I'll let you remove it if you don't mind, please :) Commits ------- 3ff69f0 [DI] remove deprecated code paths
2 parents a2f2769 + 3ff69f0 commit ceb40c1

22 files changed

+15
-348
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

1414
use Psr\Container\ContainerInterface;
15-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
1615
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1716
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
1817
use Symfony\Component\Routing\RouterInterface;
18+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1919

2020
/**
2121
* Generates the router matcher and generator classes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
1313

1414
use Psr\Container\ContainerInterface;
15-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
1615
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1716
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
17+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1818
use Symfony\Contracts\Translation\TranslatorInterface;
1919

2020
/**

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Psr\Container\ContainerInterface;
1515
use Psr\Log\LoggerInterface;
16-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
1716
use Symfony\Component\Config\Loader\LoaderInterface;
1817
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
1918
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
@@ -23,6 +22,7 @@
2322
use Symfony\Component\Routing\RequestContext;
2423
use Symfony\Component\Routing\RouteCollection;
2524
use Symfony\Component\Routing\Router as BaseRouter;
25+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
2626

2727
/**
2828
* This Router creates the Loader only when the cache is empty.

src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Bundle\TwigBundle\CacheWarmer;
1313

1414
use Psr\Container\ContainerInterface;
15-
use Symfony\Bundle\TwigBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
1615
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
16+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1717
use Twig\Environment;
1818
use Twig\Error\Error;
1919

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Cache\DependencyInjection\CachePoolClearerPass;
1616
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
1717
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
18-
use Symfony\Component\DependencyInjection\Compiler\RepeatedPass;
1918
use Symfony\Component\DependencyInjection\ContainerBuilder;
2019
use Symfony\Component\DependencyInjection\Definition;
2120
use Symfony\Component\DependencyInjection\Reference;
@@ -53,12 +52,6 @@ public function testPoolRefsAreWeak()
5352
$container->setAlias('clearer_alias', 'clearer');
5453

5554
$pass = new RemoveUnusedDefinitionsPass();
56-
foreach ($container->getCompiler()->getPassConfig()->getRemovingPasses() as $removingPass) {
57-
if ($removingPass instanceof RepeatedPass) {
58-
$pass->setRepeatedPass(new RepeatedPass([$pass]));
59-
break;
60-
}
61-
}
6255
foreach ([new CachePoolPass(), $pass, new CachePoolClearerPass()] as $pass) {
6356
$pass->process($container);
6457
}

src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Config\Resource;
1313

14-
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface;
1514
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1615
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
1716
use Symfony\Contracts\Service\ServiceSubscriberInterface;
@@ -166,10 +165,7 @@ private function generateSignature(\ReflectionClass $class)
166165
}
167166
}
168167

169-
if (interface_exists(LegacyServiceSubscriberInterface::class, false) && $class->isSubclassOf(LegacyServiceSubscriberInterface::class)) {
170-
yield LegacyServiceSubscriberInterface::class;
171-
yield print_r([$class->name, 'getSubscribedServices'](), true);
172-
} elseif (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
168+
if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
173169
yield ServiceSubscriberInterface::class;
174170
yield print_r($class->name::getSubscribedServices(), true);
175171
}

src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2828
* @author Nicolas Grekas <p@tchwork.com>
2929
*/
30-
class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements RepeatablePassInterface
30+
class AnalyzeServiceReferencesPass extends AbstractRecursivePass
3131
{
3232
private $graph;
3333
private $currentDefinition;
@@ -49,14 +49,6 @@ public function __construct(bool $onlyConstructorArguments = false, bool $hasPro
4949
$this->enableExpressionProcessing();
5050
}
5151

52-
/**
53-
* {@inheritdoc}
54-
*/
55-
public function setRepeatedPass(RepeatedPass $repeatedPass)
56-
{
57-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
58-
}
59-
6052
/**
6153
* Processes a ContainerBuilder object to populate the service reference graph.
6254
*/

src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
*
2323
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2424
*/
25-
class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
25+
class InlineServiceDefinitionsPass extends AbstractRecursivePass
2626
{
2727
private $analyzingPass;
28-
private $repeatedPass;
2928
private $cloningIds = [];
3029
private $connectedIds = [];
3130
private $notInlinedIds = [];
@@ -37,15 +36,6 @@ public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null)
3736
$this->analyzingPass = $analyzingPass;
3837
}
3938

40-
/**
41-
* {@inheritdoc}
42-
*/
43-
public function setRepeatedPass(RepeatedPass $repeatedPass)
44-
{
45-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
46-
$this->repeatedPass = $repeatedPass;
47-
}
48-
4939
public function process(ContainerBuilder $container)
5040
{
5141
$this->container = $container;
@@ -94,10 +84,6 @@ public function process(ContainerBuilder $container)
9484
}
9585
} while ($this->inlinedIds && $this->analyzingPass);
9686

97-
if ($this->inlinedIds && $this->repeatedPass) {
98-
$this->repeatedPass->setRepeat();
99-
}
100-
10187
foreach ($remainingInlinedIds as $id) {
10288
$definition = $container->getDefinition($id);
10389

src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,10 @@
2020
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2121
* @author Nicolas Grekas <p@tchwork.com>
2222
*/
23-
class RemoveUnusedDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
23+
class RemoveUnusedDefinitionsPass extends AbstractRecursivePass
2424
{
2525
private $connectedIds = [];
2626

27-
/**
28-
* {@inheritdoc}
29-
*/
30-
public function setRepeatedPass(RepeatedPass $repeatedPass)
31-
{
32-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
33-
}
34-
3527
/**
3628
* Processes the ContainerBuilder to remove unused definitions.
3729
*/

src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* @author Fabien Potencier <fabien@symfony.com>
4040
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
4141
*/
42-
class Container implements ResettableContainerInterface
42+
class Container implements ContainerInterface, ResetInterface
4343
{
4444
protected $parameterBag;
4545
protected $services = [];

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,6 @@ private function parseCallable($callable, string $parameter, string $id, string
592592
throw new InvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s" in "%s").', $parameter, $id, $callable, substr($callable, 1), $file));
593593
}
594594

595-
if (false !== strpos($callable, ':') && false === strpos($callable, '::')) {
596-
$parts = explode(':', $callable);
597-
598-
@trigger_error(sprintf('Using short %s syntax for service "%s" is deprecated since Symfony 4.4, use "[\'@%s\', \'%s\']" instead.', $parameter, $id, ...$parts), E_USER_DEPRECATED);
599-
600-
return [$this->resolveServices('@'.$parts[0], $file), $parts[1]];
601-
}
602-
603595
return $callable;
604596
}
605597

0 commit comments

Comments
 (0)
0