8000 [TASK] Adapt for upcoming Symfony 5.3 command tag properties · TYPO3-CMS/core@1cfb4ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 1cfb4ef

Browse files
committed
[TASK] Adapt for upcoming Symfony 5.3 command tag properties
With the Symfony PR symfony/symfony#39851 new depndency injection console.command tag properties are supported, which allow to inject the description and the hidden state into console commands. In order to maintain a consistent console.command DI tag syntax between Symfony and TYPO3 core, we now add forward compatibility for this change. Releases: master, 10.4 Resolves: #93425 Related: #93174 Change-Id: Ie5dac65deaede2099f2d337466295bd2815ce918 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67600 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Benjamin Franzke <bfr@qbus.de> Reviewed-by: Benjamin Franzke <bfr@qbus.de>
1 parent 7641b28 commit 1cfb4ef

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Classes/DependencyInjection/ConsoleCommandPass.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ public function process(ContainerBuilder $container)
5252
foreach ($container->findTaggedServiceIds($this->tagName) as $serviceName => $tags) {
5353
$commandServiceDefinition = $container->findDefinition($serviceName)->setPublic(true);
5454
$commandName = null;
55+
$description = null;
56+
$hidden = false;
5557
$aliases = [];
5658
foreach ($tags as $attributes) {
5759
if (!isset($attributes['command'])) {
5860
continue;
5961
}
62+
$description = $attributes['description'] ?? $description;
63+
$hidden = (bool)($attributes['hidden'] ?? $hidden);
6064
$commandRegistryDefinition->addMethodCall('addLazyCommand', [
6165
$attributes['command'],
6266
$serviceName,
@@ -70,6 +74,12 @@ public function process(ContainerBuilder $container)
7074
}
7175
}
7276
$commandServiceDefinition->addMethodCall('setName', [$commandName]);
77+
if ($description) {
78+
$commandServiceDefinition->addMethodCall('setDescription', [$description]);
79+
}
80+
if ($hidden) {
81+
$commandServiceDefinition->addMethodCall('setHidden', [true]);
82+
}
7383
if ($aliases) {
7484
$commandServiceDefinition->addMethodCall('setAliases', [$aliases]);
7585
}

0 commit comments

Comments
 (0)
0