Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae00115

Browse files
committed
[Console] Fix deprecation when description is null
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
1 parent 8d0d9fa commit ae00115

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function process(ContainerBuilder $container)
5656
foreach ($commandServices as $id => $tags) {
5757
$definition = $container->getDefinition($id);
5858
$definition->addTag($this->noPreloadTag);
59+
/** @var class-string<Command> $class */
5960
$class = $container->getParameterBag()->resolveValue($definition->getClass());
6061

6162
if (isset($tags[0]['command'])) {
@@ -124,7 +125,7 @@ public function process(ContainerBuilder $container)
124125
if (!$r->isSubclassOf(Command::class)) {
125126
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
126127
}
127-
$description = str_replace('%', '%%', $class::getDefaultDescription());
128+
$description = str_replace('%', '%%', $class::getDefaultDescription() ?? '');
128129
}
129130

130131
if ($description) {

0 commit comments

Comments
 (0)