Skip to content

Commit bcb3e00

Browse files
seriquynhfabpot
authored andcommitted
[Console] Remove a redundant check in ErrorListener
1 parent 0b018cc commit bcb3e00

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Symfony/Component/Console/EventListener/ErrorListener.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,15 @@ public static function getSubscribedEvents(): array
7575
];
7676
}
7777

78-
private static function getInputString(ConsoleEvent $event): ?string
78+
private static function getInputString(ConsoleEvent $event): string
7979
{
8080
$commandName = $event->getCommand()?->getName();
81-
$input = $event->getInput();
81+
$inputString = (string) $event->getInput();
8282

83-
if ($input instanceof \Stringable) {
84-
if ($commandName) {
85-
return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
86-
}
87-
88-
return (string) $input;
83+
if ($commandName) {
84+
return str_replace(["'$commandName'", "\"$commandName\""], $commandName, $inputString);
8985
}
9086

91-
return $commandName;
87+
return $inputString;
9288
}
9389
}

0 commit comments

Comments
 (0)