diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php index 3cbe534fb9..f49f6a18c0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php @@ -21,7 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; */ class UnusedTagsPass implements CompilerPassInterface { - private $whitelist = [ + private $knownTags = [ 'annotations.cached_reader', 'auto_alias', 'cache.pool', @@ -70,11 +70,11 @@ class UnusedTagsPass implements CompilerPassInterface public function process(ContainerBuilder $container) { - $tags = array_unique(array_merge($container->findTags(), $this->whitelist)); + $tags = array_unique(array_merge($container->findTags(), $this->knownTags)); foreach ($container->findUnusedTags() as $tag) { - // skip whitelisted tags - if (\in_array($tag, $this->whitelist)) { + // skip known tags + if (\in_array($tag, $this->knownTags)) { continue; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php b/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-known-tags.php similarity index 82% rename from src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php rename to src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-known-tags.php index 7f24973cd8..ec9ae1f97c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-known-tags.php @@ -15,5 +15,5 @@ use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\UnusedTags $target = dirname(__DIR__, 2).'/DependencyInjection/Compiler/UnusedTagsPass.php'; $contents = file_get_contents($target); -$contents = preg_replace('{private \$whitelist = \[(.+?)\];}sm', "private \$whitelist = [\n '".implode("',\n '", UnusedTagsPassUtils::getDefinedTags())."',\n ];", $contents); +$contents = preg_replace('{private \$knownTags = \[(.+?)\];}sm', "private \$knownTags = [\n '".implode("',\n '", UnusedTagsPassUtils::getDefinedTags())."',\n ];", $contents); file_put_contents($target, $contents); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php index a73cdd1671..8343d0d997 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/UnusedTagsPassTest.php @@ -35,21 +35,21 @@ class UnusedTagsPassTest extends TestCase $this->assertSame([sprintf('%s: Tag "kenrel.event_subscriber" was defined on service(s) "foo", "bar", but was never used. Did you mean "kernel.event_subscriber"?', UnusedTagsPass::class)], $container->getCompiler()->getLog()); } - public function testMissingWhitelistTags() + public function testMissingKnownTags() { if (\dirname((new \ReflectionClass(ContainerBuilder::class))->getFileName(), 3) !== \dirname(__DIR__, 5)) { $this->markTestSkipped('Tests are not run from the root symfony/symfony metapackage.'); } - $this->assertSame(UnusedTagsPassUtils::getDefinedTags(), $this->getWhitelistTags(), 'The src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php file must be updated; run src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-tags-whitelist.php.'); + $this->assertSame(UnusedTagsPassUtils::getDefinedTags(), $this->getKnownTags(), 'The src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php file must be updated; run src/Symfony/Bundle/FrameworkBundle/Resources/bin/check-unused-known-tags.php.'); } - private function getWhitelistTags() + private function getKnownTags() { // get tags in UnusedTagsPass $target = \dirname(__DIR__, 3).'/DependencyInjection/Compiler/UnusedTagsPass.php'; $contents = file_get_contents($target); - preg_match('{private \$whitelist = \[(.+?)\];}sm', $contents, $matches); + preg_match('{private \$knownTags = \[(.+?)\];}sm', $contents, $matches); $tags = array_values(array_filter(array_map(function ($str) { return trim(preg_replace('{^ +\'(.+)\',}', '$1', $str)); }, explode("\n", $matches[1])))); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 7c9860b4dc..f6568b3ea3 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -1176,9 +1176,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); // don't trigger deprecations for internal uses // @deprecated since version 3.3, to be removed in 4.0 along with the deprecated class - $deprecationWhitelist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; + $deprecationAllowlist = ['event_dispatcher' => ContainerAwareEventDispatcher::class]; - if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationWhitelist[$id]) || $deprecationWhitelist[$id] !== $class)) { + if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationAllowlist[$id]) || $deprecationAllowlist[$id] !== $class)) { @trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED); } }