Skip to content

Commit f755ca9

Browse files
CS fixes
1 parent 0a90e68 commit f755ca9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+233
-233
lines changed

Application.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ public function doRun(InputInterface $input, OutputInterface $output)
270270

271271
$style = new SymfonyStyle($input, $output);
272272
$output->writeln('');
273-
$formattedBlock = (new FormatterHelper())->formatBlock(sprintf('Command "%s" is not defined.', $name), 'error', true);
273+
$formattedBlock = (new FormatterHelper())->formatBlock(\sprintf('Command "%s" is not defined.', $name), 'error', true);
274274
$output->writeln($formattedBlock);
275-
if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
275+
if (!$style->confirm(\sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
276276
if (null !== $this->dispatcher) {
277277
$event = new ConsoleErrorEvent($input, $output, $e);
278278
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
@@ -502,7 +502,7 @@ public function getLongVersion()
502502
{
503503
if ('UNKNOWN' !== $this->getName()) {
504504
if ('UNKNOWN' !== $this->getVersion()) {
505-
return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
505+
return \sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
506506
}
507507

508508
return $this->getName();
@@ -561,7 +561,7 @@ public function add(Command $command)
561561
}
562562

563563
if (!$command->getName()) {
564-
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
564+
throw new LogicException(\sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
565565
}
566566

567567
$this->commands[$command->getName()] = $command;
@@ -585,12 +585,12 @@ public function get(string $name)
585585
$this->init();
586586

587587
if (!$this->has($name)) {
588-
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
588+
throw new CommandNotFoundException(\sprintf('The command "%s" does not exist.', $name));
589589
}
590590

591591
// When the command has a different name than the one used at the command loader level
592592
if (!isset($this->commands[$name])) {
593-
throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
593+
throw new CommandNotFoundException(\sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
594594
}
595595

596596
$command = $this->commands[$name];
@@ -654,7 +654,7 @@ public function findNamespace(string $namespace): string
654654
$namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
655655

656656
if (empty($namespaces)) {
657-
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
657+
$message = \sprintf('There are no commands defined in the "%s" namespace.', $namespace);
658658

659659
if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
660660
if (1 == \count($alternatives)) {
@@ -671,7 +671,7 @@ public function findNamespace(string $namespace): string
671671

672672
$exact = \in_array($namespace, $namespaces, true);
673673
if (\count($namespaces) > 1 && !$exact) {
674-
throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
674+
throw new NamespaceNotFoundException(\sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
675675
}
676676

677677
return $exact ? $namespace : reset($namespaces);
@@ -720,7 +720,7 @@ public function find(string $name)
720720
$this->findNamespace(substr($name, 0, $pos));
721721
}
722722

723-
$message = sprintf('Command "%s" is not defined.', $name);
723+
$message = \sprintf('Command "%s" is not defined.', $name);
724724

725725
if ($alternatives = $this->findAlternatives($name, $allCommands)) {
726726
// remove hidden commands
@@ -775,14 +775,14 @@ public function find(string $name)
775775
if (\count($commands) > 1) {
776776
$suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
777777

778-
throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
778+
throw new CommandNotFoundException(\sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
779779
}
780780
}
781781

782782
$command = $this->get(reset($commands));
783783

784784
if ($command->isHidden()) {
785-
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
785+
throw new CommandNotFoundException(\sprintf('The command "%s" does not exist.', $name));
786786
}
787787

788788
return $command;
@@ -857,7 +857,7 @@ public function renderThrowable(\Throwable $e, OutputInterface $output): void
857857
$this->doRenderThrowable($e, $output);
858858

859859
if (null !== $this->runningCommand) {
860-
$output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
860+
$output->writeln(\sprintf('<info>%s</info>', OutputFormatter::escape(\sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
861861
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
862862
}
863863
}
@@ -868,7 +868,7 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo
868868
$message = trim($e->getMessage());
869869
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
870870
$class = get_debug_type($e);
871-
$title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
871+
$title = \sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
872872
$len = Helper::width($title);
873873
} else {
874874
$len = 0;
@@ -892,14 +892,14 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo
892892

893893
$messages = [];
894894
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
895-
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
895+
$messages[] = \sprintf('<comment>%s</comment>', OutputFormatter::escape(\sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
896896
}
897-
$messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
897+
$messages[] = $emptyLine = \sprintf('<error>%s</error>', str_repeat(' ', $len));
898898
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
899-
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
899+
$messages[] = \sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
900900
}
901901
foreach ($lines as $line) {
902-
$messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
902+
$messages[] = \sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
903903
}
904904
$messages[] = $emptyLine;
905905
$messages[] = '';
@@ -926,7 +926,7 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo
926926
$file = $trace[$i]['file'] ?? 'n/a';
927927
$line = $trace[$i]['line'] ?? 'n/a';
928928

929-
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
929+
$output->writeln(\sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
930930
}
931931

932932
$output->writeln('', OutputInterface::VERBOSITY_QUIET);

CI/GithubActionReporter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ private function log(string $type, string $message, ?string $file = null, ?int $
8989

9090
if (!$file) {
9191
// No file provided, output the message solely:
92-
$this->output->writeln(sprintf('::%s::%s', $type, $message));
92+
$this->output->writeln(\sprintf('::%s::%s', $type, $message));
9393

9494
return;
9595
}
9696

97-
$this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message));
97+
$this->output->writeln(\sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message));
9898
}
9999
}

Color.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(string $foreground = '', string $background = '', ar
6060

6161
foreach ($options as $option) {
6262
if (!isset(self::AVAILABLE_OPTIONS[$option])) {
63-
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
63+
throw new InvalidArgumentException(\sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
6464
}
6565

6666
$this->options[$option] = self::AVAILABLE_OPTIONS[$option];
@@ -88,7 +88,7 @@ public function set(): string
8888
return '';
8989
}
9090

91-
return sprintf("\033[%sm", implode(';', $setCodes));
91+
return \sprintf("\033[%sm", implode(';', $setCodes));
9292
}
9393

9494
public function unset(): string
@@ -107,7 +107,7 @@ public function unset(): string
107107
return '';
108108
}
109109

110-
return sprintf("\033[%sm", implode(';', $unsetCodes));
110+
return \sprintf("\033[%sm", implode(';', $unsetCodes));
111111
}
112112

113113
private function parseColor(string $color, bool $background = false): string
@@ -128,6 +128,6 @@ private function parseColor(string $color, bool $background = false): string
128128
return ($background ? '10' : '9').self::BRIGHT_COLORS[$color];
129129
}
130130

131-
throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
131+
throw new InvalidArgumentException(\sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
132132
}
133133
}

Command/Command.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function run(InputInterface $input, OutputInterface $output): int
326326
$statusCode = $this->execute($input, $output);
327327

328328
if (!\is_int($statusCode)) {
329-
throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
329+
throw new \TypeError(\sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
330330
}
331331
}
332332

@@ -446,7 +446,7 @@ public function getDefinition(): InputDefinition
446446
*/
447447
public function getNativeDefinition(): InputDefinition
448448
{
449-
return $this->definition ?? throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
449+
return $this->definition ?? throw new LogicException(\sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
450450
}
451451

452452
/**
@@ -464,7 +464,7 @@ public function addArgument(string $name, ?int $mode = null, string $description
464464
{
465465
$suggestedValues = 5 <= \func_num_args() ? func_get_arg(4) : [];
466466
if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) {
467-
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
467+
throw new \TypeError(\sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
468468
}
469469
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
470470
$this->fullDefinition?->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
@@ -488,7 +488,7 @@ public function addOption(string $name, string|array|null $shortcut = null, ?int
488488
{
489489
$suggestedValues = 6 <= \func_num_args() ? func_get_arg(5) : [];
490490
if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) {
491-
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
491+
throw new \TypeError(\sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
492492
}
493493
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues));
494494
$this->fullDefinition?->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues));
@@ -662,7 +662,7 @@ public function getSynopsis(bool $short = false): string
662662
$key = $short ? 'short' : 'long';
663663

664664
if (!isset($this->synopsis[$key])) {
665-
$this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
665+
$this->synopsis[$key] = trim(\sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
666666
}
667667

668668
return $this->synopsis[$key];
@@ -676,7 +676,7 @@ public function getSynopsis(bool $short = false): string
676676
public function addUsage(string $usage): static
677677
{
678678
if (!str_starts_with($usage, $this->name)) {
679-
$usage = sprintf('%s %s', $this->name, $usage);
679+
$usage = \sprintf('%s %s', $this->name, $usage);
680680
}
681681

682682
$this->usages[] = $usage;
@@ -703,7 +703,7 @@ public function getUsages(): array
703703
public function getHelper(string $name): mixed
704704
{
705705
if (null === $this->helperSet) {
706-
throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
706+
throw new LogicException(\sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
707707
}
708708

709709
return $this->helperSet->get($name);
@@ -719,7 +719,7 @@ public function getHelper(string $name): mixed
719719
private function validateName(string $name): void
720720
{
721721
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
722-
throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
722+
throw new InvalidArgumentException(\sprintf('Command name "%s" is invalid.', $name));
723723
}
724724
}
725725
}

Command/CompleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8585
// "symfony" must be kept for compat with the shell scripts generated by Symfony Console 5.4 - 6.1
8686
$version = $input->getOption('symfony') ? '1' : $input->getOption('api-version');
8787
if ($version && version_compare($version, self::COMPLETION_API_VERSION, '<')) {
88-
$message = sprintf('Completion script version is not supported ("%s" given, ">=%s" required).', $version, self::COMPLETION_API_VERSION);
88+
$message = \sprintf('Completion script version is not supported ("%s" given, ">=%s" required).', $version, self::COMPLETION_API_VERSION);
8989
$this->log($message);
9090

9191
$output->writeln($message.' Install the Symfony completion script again by using the "completion" command.');
@@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9999
}
100100

101101
if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
102-
throw new \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
102+
throw new \RuntimeException(\sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
103103
}
104104

105105
$completionInput = $this->createCompletionInput($input);

Command/DumpCompletionCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
108108
$output = $output->getErrorOutput();
109109
}
110110
if ($shell) {
111-
$output->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
111+
$output->writeln(\sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
112112
} else {
113-
$output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
113+
$output->writeln(\sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
114114
}
115115

116116
return 2;

Command/SignalableCommandInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ public function getSubscribedSignals(): array;
3030
*
3131
* @return int|false The exit code to return or false to continue the normal execution
3232
*/
33-
public function handleSignal(int $signal, /* int|false $previousExitCode = 0 */);
33+
public function handleSignal(int $signal/* , int|false $previousExitCode = 0 */);
3434
}

CommandLoader/ContainerCommandLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(ContainerInterface $container, array $commandMap)
3737
public function get(string $name): Command
3838
{
3939
if (!$this->has($name)) {
40-
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
40+
throw new CommandNotFoundException(\sprintf('Command "%s" does not exist.', $name));
4141
}
4242

4343
return $this->container->get($this->commandMap[$name]);

CommandLoader/FactoryCommandLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function has(string $name): bool
3939
public function get(string $name): Command
4040
{
4141
if (!isset($this->factories[$name])) {
42-
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
42+
throw new CommandNotFoundException(\sprintf('Command "%s" does not exist.', $name));
4343
}
4444

4545
$factory = $this->factories[$name];

Completion/Suggestion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Suggestion implements \Stringable
2020
{
2121
public function __construct(
2222
private readonly string $value,
23-
private readonly string $description = ''
23+
private readonly string $description = '',
2424
) {
2525
}
2626

0 commit comments

Comments
 (0)