Skip to content

Commit deb04f2

Browse files
committed
[Console] Prevent PHP 8.1 str_replace deprec on null
Prevents: > Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated on `getDefaultName()` returning `null`
1 parent 9212bbb commit deb04f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function process(ContainerBuilder $container)
6767
if (!$r->isSubclassOf(Command::class)) {
6868
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
6969
}
70-
$aliases = str_replace('%', '%%', $class::getDefaultName());
70+
$aliases = str_replace('%', '%%', $class::getDefaultName() ?? '');
7171
}
7272

7373
$aliases = explode('|', $aliases ?? '');

0 commit comments

Comments
 (0)