From 3ff69f09f1c2fc37f16ed7ad6284c18d4106af06 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Jun 2019 10:51:44 +0200 Subject: [PATCH] [DI] remove deprecated code paths --- .../CacheWarmer/RouterCacheWarmer.php | 2 +- .../CacheWarmer/TranslationsCacheWarmer.php | 2 +- ...ompatibilityServiceSubscriberInterface.php | 31 ------- .../Bundle/FrameworkBundle/Routing/Router.php | 2 +- .../CacheWarmer/TemplateCacheWarmer.php | 2 +- ...ompatibilityServiceSubscriberInterface.php | 31 ------- .../CachePoolClearerPassTest.php | 7 -- .../Resource/ReflectionClassResource.php | 6 +- .../Compiler/AnalyzeServiceReferencesPass.php | 10 +-- .../Compiler/InlineServiceDefinitionsPass.php | 16 +--- .../Compiler/RemoveUnusedDefinitionsPass.php | 10 +-- .../Compiler/RepeatablePassInterface.php | 25 ------ .../Compiler/RepeatedPass.php | 83 ------------------- .../DependencyInjection/Container.php | 2 +- .../Loader/YamlFileLoader.php | 8 -- .../ResettableContainerInterface.php | 35 -------- .../ServiceSubscriberInterface.php | 23 ----- .../Compiler/DecoratorServicePassTest.php | 4 +- .../Tests/Compiler/IntegrationTest.php | 2 +- .../RegisterServiceSubscribersPassTest.php | 2 +- .../Tests/Loader/YamlFileLoaderTest.php | 29 ------- .../DependencyInjection/TypedReference.php | 31 +------ 22 files changed, 15 insertions(+), 348 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php delete mode 100644 src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php delete mode 100644 src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php delete mode 100644 src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php delete mode 100644 src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php delete mode 100644 src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 6381789eade0f..6450eb33d7243 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -12,10 +12,10 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Component\Routing\RouterInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; /** * Generates the router matcher and generator classes. diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php index c8a246bca353d..a47c28b9c48d2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php @@ -12,9 +12,9 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php deleted file mode 100644 index 41d4aa81e99c1..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -if (interface_exists(LegacyServiceSubscriberInterface::class)) { - /** - * @internal - */ - interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface - { - } -} else { - /** - * @internal - */ - interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface - { - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index c69de1fc3fbb3..f1cca310d2e3b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -13,7 +13,6 @@ use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Config\ContainerParametersResource; use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface; @@ -23,6 +22,7 @@ use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Router as BaseRouter; +use Symfony\Contracts\Service\ServiceSubscriberInterface; /** * This Router creates the Loader only when the cache is empty. diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index b31b344f451d2..be4c56d83033f 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -12,8 +12,8 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Bundle\TwigBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; use Twig\Environment; use Twig\Error\Error; diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php deleted file mode 100644 index 967f732ff59f9..0000000000000 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\TwigBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -if (interface_exists(LegacyServiceSubscriberInterface::class)) { - /** - * @internal - */ - interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface - { - } -} else { - /** - * @internal - */ - interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface - { - } -} diff --git a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php index 533aa14afff06..202e05c4ab863 100644 --- a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php +++ b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php @@ -15,7 +15,6 @@ use Symfony\Component\Cache\DependencyInjection\CachePoolClearerPass; use Symfony\Component\Cache\DependencyInjection\CachePoolPass; use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass; -use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; @@ -53,12 +52,6 @@ public function testPoolRefsAreWeak() $container->setAlias('clearer_alias', 'clearer'); $pass = new RemoveUnusedDefinitionsPass(); - foreach ($container->getCompiler()->getPassConfig()->getRemovingPasses() as $removingPass) { - if ($removingPass instanceof RepeatedPass) { - $pass->setRepeatedPass(new RepeatedPass([$pass])); - break; - } - } foreach ([new CachePoolPass(), $pass, new CachePoolClearerPass()] as $pass) { $pass->process($container); } diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index 940b24d79b951..1c582183d2ca4 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Config\Resource; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Messenger\Handler\MessageSubscriberInterface; use Symfony\Contracts\Service\ServiceSubscriberInterface; @@ -166,10 +165,7 @@ private function generateSignature(\ReflectionClass $class) } } - if (interface_exists(LegacyServiceSubscriberInterface::class, false) && $class->isSubclassOf(LegacyServiceSubscriberInterface::class)) { - yield LegacyServiceSubscriberInterface::class; - yield print_r([$class->name, 'getSubscribedServices'](), true); - } elseif (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) { + if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) { yield ServiceSubscriberInterface::class; yield print_r($class->name::getSubscribedServices(), true); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index d10ee4575bfe8..d71b0138e4fa9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -27,7 +27,7 @@ * @author Johannes M. Schmitt * @author Nicolas Grekas */ -class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements RepeatablePassInterface +class AnalyzeServiceReferencesPass extends AbstractRecursivePass { private $graph; private $currentDefinition; @@ -49,14 +49,6 @@ public function __construct(bool $onlyConstructorArguments = false, bool $hasPro $this->enableExpressionProcessing(); } - /** - * {@inheritdoc} - */ - public function setRepeatedPass(RepeatedPass $repeatedPass) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); - } - /** * Processes a ContainerBuilder object to populate the service reference graph. */ diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 2efffa1b984f8..9a80286f4ee23 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -22,10 +22,9 @@ * * @author Johannes M. Schmitt */ -class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface +class InlineServiceDefinitionsPass extends AbstractRecursivePass { private $analyzingPass; - private $repeatedPass; private $cloningIds = []; private $connectedIds = []; private $notInlinedIds = []; @@ -37,15 +36,6 @@ public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null) $this->analyzingPass = $analyzingPass; } - /** - * {@inheritdoc} - */ - public function setRepeatedPass(RepeatedPass $repeatedPass) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); - $this->repeatedPass = $repeatedPass; - } - public function process(ContainerBuilder $container) { $this->container = $container; @@ -94,10 +84,6 @@ public function process(ContainerBuilder $container) } } while ($this->inlinedIds && $this->analyzingPass); - if ($this->inlinedIds && $this->repeatedPass) { - $this->repeatedPass->setRepeat(); - } - foreach ($remainingInlinedIds as $id) { $definition = $container->getDefinition($id); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php index 287af23b77f02..d87ac4fea37e6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php @@ -20,18 +20,10 @@ * @author Johannes M. Schmitt * @author Nicolas Grekas */ -class RemoveUnusedDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface +class RemoveUnusedDefinitionsPass extends AbstractRecursivePass { private $connectedIds = []; - /** - * {@inheritdoc} - */ - public function setRepeatedPass(RepeatedPass $repeatedPass) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); - } - /** * Processes the ContainerBuilder to remove unused definitions. */ diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php deleted file mode 100644 index 11a5b0d54ffa9..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -/** - * Interface that must be implemented by passes that are run as part of an - * RepeatedPass. - * - * @author Johannes M. Schmitt - * - * @deprecated since Symfony 4.2. - */ -interface RepeatablePassInterface extends CompilerPassInterface -{ - public function setRepeatedPass(RepeatedPass $repeatedPass); -} diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php deleted file mode 100644 index b8add1b83d263..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', RepeatedPass::class), E_USER_DEPRECATED); - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * A pass that might be run repeatedly. - * - * @author Johannes M. Schmitt - * - * @deprecated since Symfony 4.2. - */ -class RepeatedPass implements CompilerPassInterface -{ - /** - * @var bool - */ - private $repeat = false; - - private $passes; - - /** - * @param RepeatablePassInterface[] $passes An array of RepeatablePassInterface objects - * - * @throws InvalidArgumentException when the passes don't implement RepeatablePassInterface - */ - public function __construct(array $passes) - { - foreach ($passes as $pass) { - if (!$pass instanceof RepeatablePassInterface) { - throw new InvalidArgumentException('$passes must be an array of RepeatablePassInterface.'); - } - - $pass->setRepeatedPass($this); - } - - $this->passes = $passes; - } - - /** - * Process the repeatable passes that run more than once. - */ - public function process(ContainerBuilder $container) - { - do { - $this->repeat = false; - foreach ($this->passes as $pass) { - $pass->process($container); - } - } while ($this->repeat); - } - - /** - * Sets if the pass should repeat. - */ - public function setRepeat() - { - $this->repeat = true; - } - - /** - * Returns the passes. - * - * @return RepeatablePassInterface[] An array of RepeatablePassInterface objects - */ - public function getPasses() - { - return $this->passes; - } -} diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 9d16f9c27c4a8..75f8c1dcffee7 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -39,7 +39,7 @@ * @author Fabien Potencier * @author Johannes M. Schmitt */ -class Container implements ResettableContainerInterface +class Container implements ContainerInterface, ResetInterface { protected $parameterBag; protected $services = []; diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index cbb39ae0357d7..010b0055a0ace 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -592,14 +592,6 @@ private function parseCallable($callable, string $parameter, string $id, string 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)); } - if (false !== strpos($callable, ':') && false === strpos($callable, '::')) { - $parts = explode(':', $callable); - - @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); - - return [$this->resolveServices('@'.$parts[0], $file), $parts[1]]; - } - return $callable; } diff --git a/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php b/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php deleted file mode 100644 index b9714d25098fe..0000000000000 --- a/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Contracts\Service\ResetInterface; - -/** - * ResettableContainerInterface defines additional resetting functionality - * for containers, allowing to release shared services when the container is - * not needed anymore. - * - * @author Christophe Coevoet - * - * @deprecated since Symfony 4.2, use "Symfony\Contracts\Service\ResetInterface" instead. - */ -interface ResettableContainerInterface extends ContainerInterface, ResetInterface -{ - /** - * Resets shared services from the container. - * - * The container is not intended to be used again after being reset in a normal workflow. This method is - * meant as a way to release references for ref-counting. - * A subsequent call to ContainerInterface::get will recreate a new instance of the shared service. - */ - public function reset(); -} diff --git a/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php b/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php deleted file mode 100644 index a3b6ba790718e..0000000000000 --- a/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Contracts\Service\ServiceSubscriberInterface as BaseServiceSubscriberInterface; - -/** - * {@inheritdoc} - * - * @deprecated since Symfony 4.2, use Symfony\Contracts\Service\ServiceSubscriberInterface instead. - */ -interface ServiceSubscriberInterface extends BaseServiceSubscriberInterface -{ -} diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php index d8d7587c8d425..82842965c86a9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php @@ -169,7 +169,7 @@ public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitio protected function process(ContainerBuilder $container) { - $repeatedPass = new DecoratorServicePass(); - $repeatedPass->process($container); + $pass = new DecoratorServicePass(); + $pass->process($container); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index 83d3e23d3ba5a..086e142db8109 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -20,10 +20,10 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use Symfony\Component\DependencyInjection\Tests\Fixtures\BarTagClass; use Symfony\Component\DependencyInjection\Tests\Fixtures\FooBarTaggedClass; use Symfony\Component\DependencyInjection\Tests\Fixtures\FooTagClass; +use Symfony\Contracts\Service\ServiceSubscriberInterface; /** * This class tests the integration of the different compiler passes. diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php index e501d1fca3860..14d542f76a227 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -21,7 +21,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition2; @@ -30,6 +29,7 @@ use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriberChild; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriberParent; use Symfony\Component\DependencyInjection\TypedReference; +use Symfony\Contracts\Service\ServiceSubscriberInterface; use Symfony\Contracts\Service\ServiceSubscriberTrait; require_once __DIR__.'/../Fixtures/includes/classes.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 0aa30f288c701..5577267df68a4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -191,21 +191,6 @@ public function testDeprecatedAliases() $this->assertSame($message, $container->getAlias('alias_for_foobar')->getDeprecationMessage('alias_for_foobar')); } - /** - * @group legacy - */ - public function testLoadFactoryShortSyntax() - { - $container = new ContainerBuilder(); - $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); - $loader->load('services14.yml'); - $services = $container->getDefinitions(); - - $this->assertEquals([new Reference('baz'), 'getClass'], $services['factory']->getFactory(), '->load() parses the factory tag with service:method'); - $this->assertEquals(['FooBacFactory', 'createFooBar'], $services['factory_with_static_call']->getFactory(), '->load() parses the factory tag with Class::method'); - $this->assertEquals([new Reference('factory'), '__invoke'], $services['invokable_factory']->getFactory(), '->load() parses string service reference'); - } - public function testFactorySyntaxError() { $container = new ContainerBuilder(); @@ -215,20 +200,6 @@ public function testFactorySyntaxError() $loader->load('bad_factory_syntax.yml'); } - /** - * @group legacy - */ - public function testLoadConfiguratorShortSyntax() - { - $container = new ContainerBuilder(); - $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); - $loader->load('services_configurator_short_syntax.yml'); - $services = $container->getDefinitions(); - - $this->assertEquals([new Reference('foo_bar_configurator'), 'configure'], $services['foo_bar']->getConfigurator(), '->load() parses the configurator tag with service:method'); - $this->assertEquals(['FooBarConfigurator', 'configureFooBar'], $services['foo_bar_with_static_call']->getConfigurator(), '->load() parses the configurator tag with Class::method'); - } - public function testExtensions() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/TypedReference.php b/src/Symfony/Component/DependencyInjection/TypedReference.php index f80ac50563972..3765bc73f83a0 100644 --- a/src/Symfony/Component/DependencyInjection/TypedReference.php +++ b/src/Symfony/Component/DependencyInjection/TypedReference.php @@ -28,16 +28,9 @@ class TypedReference extends Reference * @param int $invalidBehavior The behavior when the service does not exist * @param string $name The name of the argument targeting the service */ - public function __construct(string $id, string $type, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name = null) + public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, string $name = null) { - if (\is_string($invalidBehavior ?? '') || \is_int($name)) { - @trigger_error(sprintf('The $requiringClass argument of "%s()" is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); - - $this->requiringClass = $invalidBehavior; - $invalidBehavior = 3 < \func_num_args() ? \func_get_arg(3) : ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - } else { - $this->name = $type === $id ? $name : null; - } + $this->name = $type === $id ? $name : null; parent::__construct($id, $invalidBehavior); $this->type = $type; } @@ -51,24 +44,4 @@ public function getName(): ?string { return $this->name; } - - /** - * @deprecated since Symfony 4.1 - */ - public function getRequiringClass() - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); - - return $this->requiringClass ?? ''; - } - - /** - * @deprecated since Symfony 4.1 - */ - public function canBeAutoregistered() - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED); - - return $this->requiringClass && (false !== $i = strpos($this->type, '\\')) && 0 === strncasecmp($this->type, $this->requiringClass, 1 + $i); - } } 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