diff --git a/Command/Command.php b/Command/Command.php index e69bae098..986d4bd7f 100644 --- a/Command/Command.php +++ b/Command/Command.php @@ -235,7 +235,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) * * @return int The command exit code * - * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. + * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. * * @see setCode() * @see execute() diff --git a/Command/CompleteCommand.php b/Command/CompleteCommand.php index a94021ce4..11ada4e44 100644 --- a/Command/CompleteCommand.php +++ b/Command/CompleteCommand.php @@ -65,15 +65,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int { try { // uncomment when a bugfix or BC break has been introduced in the shell completion scripts - //$version = $input->getOption('symfony'); - //if ($version && version_compare($version, 'x.y', '>=')) { + // $version = $input->getOption('symfony'); + // if ($version && version_compare($version, 'x.y', '>=')) { // $message = sprintf('Completion script version is not supported ("%s" given, ">=x.y" required).', $version); // $this->log($message); // $output->writeln($message.' Install the Symfony completion script again by using the "completion" command.'); // return 126; - //} + // } $shell = $input->getOption('shell'); if (!$shell) { diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index 2e1ccb2ab..d53420b97 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -24,6 +24,7 @@ use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Terminal; + use function Symfony\Component\String\s; /** diff --git a/Helper/Table.php b/Helper/Table.php index 4636ef84b..0d8da6c54 100644 --- a/Helper/Table.php +++ b/Helper/Table.php @@ -616,7 +616,7 @@ private function fillNextRows(array $rows, int $line): array { $unmergedRows = []; foreach ($rows[$line] as $column => $cell) { - if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !$cell instanceof \Stringable) { + if (null !== $cell && !$cell instanceof TableCell && !\is_scalar($cell) && !$cell instanceof \Stringable) { throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { diff --git a/Logger/ConsoleLogger.php b/Logger/ConsoleLogger.php index 61a782150..c9714c37b 100644 --- a/Logger/ConsoleLogger.php +++ b/Logger/ConsoleLogger.php @@ -106,7 +106,7 @@ private function interpolate(string $message, array $context): string $replacements = []; foreach ($context as $key => $val) { - if (null === $val || is_scalar($val) || $val instanceof \Stringable) { + if (null === $val || \is_scalar($val) || $val instanceof \Stringable) { $replacements["{{$key}}"] = $val; } elseif ($val instanceof \DateTimeInterface) { $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339); diff --git a/Resources/completion.bash b/Resources/completion.bash index c5e89c3c2..fba46070c 100644 --- a/Resources/completion.bash +++ b/Resources/completion.bash @@ -13,9 +13,11 @@ _sf_{{ COMMAND_NAME }}() { # for an alias, get the real script behind it if [[ $(type -t $sf_cmd) == "alias" ]]; then sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/") + else + sf_cmd=$(type -p $sf_cmd) fi - if [ ! -f "$sf_cmd" ]; then + if [ ! -x "$sf_cmd" ]; then return 1 fi diff --git a/SignalRegistry/SignalRegistry.php b/SignalRegistry/SignalRegistry.php index 15978febc..f51c0c39e 100644 --- a/SignalRegistry/SignalRegistry.php +++ b/SignalRegistry/SignalRegistry.php @@ -43,7 +43,7 @@ public static function isSupported(): bool return false; } - if (\in_array('pcntl_signal', explode(',', ini_get('disable_functions')))) { + if (\in_array('pcntl_signal', explode(',', \ini_get('disable_functions')))) { return false; } diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index 56ad30a6f..27302429f 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -422,18 +422,18 @@ private function autoPrependBlock(): void $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); if (!isset($chars[0])) { - $this->newLine(); //empty history, so we should start with a new line. + $this->newLine(); // empty history, so we should start with a new line. return; } - //Prepend new line for each non LF chars (This means no blank line was output before) + // Prepend new line for each non LF chars (This means no blank line was output before) $this->newLine(2 - substr_count($chars, "\n")); } private function autoPrependText(): void { $fetched = $this->bufferedOutput->fetch(); - //Prepend new line if last char isn't EOL: + // Prepend new line if last char isn't EOL: if (!str_ends_with($fetched, "\n")) { $this->newLine(); } diff --git a/Tests/Command/CompleteCommandTest.php b/Tests/Command/CompleteCommandTest.php index 642d5c69a..e6c74a736 100644 --- a/Tests/Command/CompleteCommandTest.php +++ b/Tests/Command/CompleteCommandTest.php @@ -139,7 +139,7 @@ public function configure(): void $this->setName('hello') ->setAliases(['ahoy']) ->addArgument('name', InputArgument::REQUIRED) - ; + ; } public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void diff --git a/Tests/Formatter/OutputFormatterTest.php b/Tests/Formatter/OutputFormatterTest.php index 21970f79e..c6d2184e9 100644 --- a/Tests/Formatter/OutputFormatterTest.php +++ b/Tests/Formatter/OutputFormatterTest.php @@ -284,7 +284,7 @@ public function testContentWithLineBreaks() some text EOF - )); + )); $this->assertEquals(<<some text EOF - )); + )); $this->assertEquals(<< EOF - )); + )); $this->assertEquals(<< EOF - )); + )); } public function testFormatAndWrap() diff --git a/Tests/Helper/SymfonyQuestionHelperTest.php b/Tests/Helper/SymfonyQuestionHelperTest.php index 7877aabaa..72c3f879f 100644 --- a/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/Tests/Helper/SymfonyQuestionHelperTest.php @@ -162,7 +162,7 @@ public function testChoiceQuestionPadding() [łabądź] baz > EOT - , $output, true); + , $output, true); } public function testChoiceQuestionCustomPrompt() @@ -181,7 +181,7 @@ public function testChoiceQuestionCustomPrompt() [0] foo >ccc> EOT - , $output, true); + , $output, true); } protected function getInputStream($input) diff --git a/Tests/Tester/CommandTesterTest.php b/Tests/Tester/CommandTesterTest.php index 388a5249e..d3c644340 100644 --- a/Tests/Tester/CommandTesterTest.php +++ b/Tests/Tester/CommandTesterTest.php @@ -237,8 +237,7 @@ public function testErrorOutput() $command->addArgument('foo'); $command->setCode(function ($input, $output) { $output->getErrorOutput()->write('foo'); - } - ); + }); $tester = new CommandTester($command); $tester->execute(