10000 inline strings · symfony/symfony@1844f00 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1844f00

Browse files
committed
inline strings
1 parent 557ce57 commit 1844f00

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,16 @@
2929
*/
3030
class AddConsoleCommandPass implements CompilerPassInterface
3131
{
32-
private const COMMAND_LOADER_SERVICE_ID = 'console.command_loader';
33-
private const COMMAND_TAG = 'console.command';
34-
private const NO_PRELOAD_TAG = 'container.no_preload';
35-
private const PRIVATE_TAG_NAME = 'container.private';
36-
3732
public function process(ContainerBuilder $container)
3833
{
39-
$commandServices = $container->findTaggedServiceIds(self::COMMAND_TAG, true);
34+
$commandServices = $container->findTaggedServiceIds('console.command', true);
4035
$lazyCommandMap = [];
4136
$lazyCommandRefs = [];
4237
$serviceIds = [];
4338

4439
foreach ($commandServices as $id => $tags) {
4540
$definition = $container->getDefinition($id);
46-
$definition->addTag(self::NO_PRELOAD_TAG);
41+
$definition->addTag('container.no_preload');
4742
$class = $container->getParameterBag()->resolveValue($definition->getClass());
4843

4944
if (isset($tags[0]['command'])) {
@@ -53,7 +48,7 @@ public function process(ContainerBuilder $container)
5348
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
5449
}
5550
if (!$r->isSubclassOf(Command::class)) {
56-
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, self::COMMAND_TAG, Command::class));
51+
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, 'console.command', Command::class));
5752
}
5853
$aliases = $class::getDefaultName();
5954
}
@@ -66,7 +61,7 @@ public function process(ContainerBuilder $container)
6661
}
6762

6863
if (null === $commandName) {
69-
if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag(self::PRIVATE_TAG_NAME)) {
64+
if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag('container.private')) {
7065
$commandId = 'console.command.public_alias.'.$id;
7166
$container->setAlias($commandId, $id)->setPublic(true);
7267
$id = $commandId;
@@ -110,7 +105,7 @@ public function process(ContainerBuilder $container)
110105
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
111106
}
112107
if (!$r->isSubclassOf(Command::class)) {
113-
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, self::COMMAND_TAG, Command::class));
108+
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, 'console.command', Command::class));
114109
}
115110
$description = $class::getDefaultDescription();
116111
}
@@ -126,9 +121,9 @@ public function process(ContainerBuilder $container)
126121
}
127122

128123
$container
129-
->register(self::COMMAND_LOADER_SERVICE_ID, ContainerCommandLoader::class)
124+
->register('console.command_loader', ContainerCommandLoader::class)
130125
->setPublic(true)
131-
->addTag(self::NO_PRELOAD_TAG)
126+
->addTag('container.no_preload')
132127
->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
133128

134129
$container->setParameter('console.command.ids', $serviceIds);

0 commit comments

Comments
 (0)
0