From cb18660bbf2ce214cf46c0a9ba13bba3a0c737d3 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 5 Dec 2021 16:41:54 +0100 Subject: [PATCH 1/4] Fix parameter types for ProcessHelper::mustRun() --- Helper/ProcessHelper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Helper/ProcessHelper.php b/Helper/ProcessHelper.php index d580357b9..862d09f21 100644 --- a/Helper/ProcessHelper.php +++ b/Helper/ProcessHelper.php @@ -95,10 +95,10 @@ public function run(OutputInterface $output, $cmd, $error = null, callable $call * This is identical to run() except that an exception is thrown if the process * exits with a non-zero exit code. * - * @param string|Process $cmd An instance of Process or a command to run - * @param string|null $error An error message that must be displayed if something went wrong - * @param callable|null $callback A PHP callback to run whenever there is some - * output available on STDOUT or STDERR + * @param array|Process $cmd An instance of Process or a command to run + * @param string|null $error An error message that must be displayed if something went wrong + * @param callable|null $callback A PHP callback to run whenever there is some + * output available on STDOUT or STDERR * * @return Process The process that ran * From 829274f302eaa7b4469ae51278d048ad0c0964fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20TAMARELLE?= Date: Mon, 6 Dec 2021 17:23:18 +0100 Subject: [PATCH 2/4] Handle alias in completion script --- Resources/completion.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Resources/completion.bash b/Resources/completion.bash index 971af088b..c5e89c3c2 100644 --- a/Resources/completion.bash +++ b/Resources/completion.bash @@ -9,6 +9,12 @@ _sf_{{ COMMAND_NAME }}() { # Use newline as only separator to allow space in completion values IFS=$'\n' local sf_cmd="${COMP_WORDS[0]}" + + # 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/") + fi + if [ ! -f "$sf_cmd" ]; then return 1 fi From d5818ed8c269e92c7767db7f4c8ed2ca97359a9a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 7 Dec 2021 12:27:08 +0100 Subject: [PATCH 3/4] Remove FQCN type hints on properties --- Application.php | 14 +++++++------- CI/GithubActionReporter.php | 2 +- Command/Command.php | 8 ++++---- Command/HelpCommand.php | 2 +- Command/LazyCommand.php | 2 +- Command/LockableTrait.php | 3 +-- CommandLoader/ContainerCommandLoader.php | 2 +- Cursor.php | 2 +- Descriptor/ApplicationDescription.php | 2 +- Event/ConsoleEvent.php | 4 ++-- EventListener/ErrorListener.php | 2 +- Formatter/NullOutputFormatter.php | 2 +- Formatter/OutputFormatter.php | 2 +- Formatter/OutputFormatterStyle.php | 2 +- Formatter/OutputFormatterStyleStack.php | 2 +- Helper/Dumper.php | 6 +++--- Helper/ProgressBar.php | 6 +++--- Helper/ProgressIndicator.php | 2 +- Helper/Table.php | 4 ++-- Input/InputDefinition.php | 4 ++-- Logger/ConsoleLogger.php | 2 +- Output/ConsoleOutput.php | 2 +- Output/ConsoleSectionOutput.php | 2 +- Output/NullOutput.php | 2 +- Output/Output.php | 2 +- Style/OutputStyle.php | 2 +- Style/SymfonyStyle.php | 10 +++++----- Tester/ApplicationTester.php | 2 +- Tester/CommandTester.php | 2 +- Tester/TesterTrait.php | 4 ++-- 30 files changed, 51 insertions(+), 52 deletions(-) diff --git a/Application.php b/Application.php index b582435f7..09234f5eb 100644 --- a/Application.php +++ b/Application.php @@ -72,20 +72,20 @@ class Application implements ResetInterface { private array $commands = []; private bool $wantHelps = false; - private ?Command $runningCommand = null; + private $runningCommand = null; private string $name; private string $version; - private ?CommandLoaderInterface $commandLoader = null; + private $commandLoader = null; private bool $catchExceptions = true; private bool $autoExit = true; - private InputDefinition $definition; - private HelperSet $helperSet; - private ?EventDispatcherInterface $dispatcher = null; - private Terminal $terminal; + private $definition; + private $helperSet; + private $dispatcher = null; + private $terminal; private string $defaultCommand; private bool $singleCommand = false; private bool $initialized = false; - private SignalRegistry $signalRegistry; + private $signalRegistry; private array $signalsToDispatchEvent = []; public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN') diff --git a/CI/GithubActionReporter.php b/CI/GithubActionReporter.php index 7e5565469..a15c1ff18 100644 --- a/CI/GithubActionReporter.php +++ b/CI/GithubActionReporter.php @@ -20,7 +20,7 @@ */ class GithubActionReporter { - private OutputInterface $output; + private $output; /** * @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/core/src/command.ts#L80-L85 diff --git a/Command/Command.php b/Command/Command.php index d6354b4ab..e69bae098 100644 --- a/Command/Command.php +++ b/Command/Command.php @@ -47,20 +47,20 @@ class Command */ protected static $defaultDescription; - private ?Application $application = null; + private $application = null; private ?string $name = null; private ?string $processTitle = null; private array $aliases = []; - private InputDefinition $definition; + private $definition; private bool $hidden = false; private string $help = ''; private string $description = ''; - private ?InputDefinition $fullDefinition = null; + private $fullDefinition = null; private bool $ignoreValidationErrors = false; private ?\Closure $code = null; private array $synopsis = []; private array $usages = []; - private ?HelperSet $helperSet = null; + private $helperSet = null; public static function getDefaultName(): ?string { diff --git a/Command/HelpCommand.php b/Command/HelpCommand.php index ad4b813e4..66f8593eb 100644 --- a/Command/HelpCommand.php +++ b/Command/HelpCommand.php @@ -27,7 +27,7 @@ */ class HelpCommand extends Command { - private Command $command; + private $command; /** * {@inheritdoc} diff --git a/Command/LazyCommand.php b/Command/LazyCommand.php index b674a6387..aec412679 100644 --- a/Command/LazyCommand.php +++ b/Command/LazyCommand.php @@ -24,7 +24,7 @@ */ final class LazyCommand extends Command { - private \Closure|Command $command; + private $command; private ?bool $isEnabled; public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true) diff --git a/Command/LockableTrait.php b/Command/LockableTrait.php index 67923a9e8..796955142 100644 --- a/Command/LockableTrait.php +++ b/Command/LockableTrait.php @@ -13,7 +13,6 @@ use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Lock\LockFactory; -use Symfony\Component\Lock\LockInterface; use Symfony\Component\Lock\Store\FlockStore; use Symfony\Component\Lock\Store\SemaphoreStore; @@ -24,7 +23,7 @@ */ trait LockableTrait { - private ?LockInterface $lock = null; + private $lock = null; /** * Locks a command. diff --git a/CommandLoader/ContainerCommandLoader.php b/CommandLoader/ContainerCommandLoader.php index 651fb665e..9b26577f0 100644 --- a/CommandLoader/ContainerCommandLoader.php +++ b/CommandLoader/ContainerCommandLoader.php @@ -22,7 +22,7 @@ */ class ContainerCommandLoader implements CommandLoaderInterface { - private ContainerInterface $container; + private $container; private array $commandMap; /** diff --git a/Cursor.php b/Cursor.php index 03e8c618b..995e3d7dd 100644 --- a/Cursor.php +++ b/Cursor.php @@ -18,7 +18,7 @@ */ final class Cursor { - private OutputInterface $output; + private $output; private $input; /** diff --git a/Descriptor/ApplicationDescription.php b/Descriptor/ApplicationDescription.php index 5f32173ae..0802f1b38 100644 --- a/Descriptor/ApplicationDescription.php +++ b/Descriptor/ApplicationDescription.php @@ -24,7 +24,7 @@ class ApplicationDescription { public const GLOBAL_NAMESPACE = '_global'; - private Application $application; + private $application; private ?string $namespace; private bool $showHidden; private array $namespaces; diff --git a/Event/ConsoleEvent.php b/Event/ConsoleEvent.php index 6ba1615fe..56b8a9a60 100644 --- a/Event/ConsoleEvent.php +++ b/Event/ConsoleEvent.php @@ -25,8 +25,8 @@ class ConsoleEvent extends Event { protected $command; - private InputInterface $input; - private OutputInterface $output; + private $input; + private $output; public function __construct(?Command $command, InputInterface $input, OutputInterface $output) { diff --git a/EventListener/ErrorListener.php b/EventListener/ErrorListener.php index bcd918331..61bd9d344 100644 --- a/EventListener/ErrorListener.php +++ b/EventListener/ErrorListener.php @@ -24,7 +24,7 @@ */ class ErrorListener implements EventSubscriberInterface { - private ?LoggerInterface $logger; + private $logger; public function __construct(LoggerInterface $logger = null) { diff --git a/Formatter/NullOutputFormatter.php b/Formatter/NullOutputFormatter.php index d14db326a..d770e1465 100644 --- a/Formatter/NullOutputFormatter.php +++ b/Formatter/NullOutputFormatter.php @@ -16,7 +16,7 @@ */ final class NullOutputFormatter implements OutputFormatterInterface { - private NullOutputFormatterStyle $style; + private $style; /** * {@inheritdoc} diff --git a/Formatter/OutputFormatter.php b/Formatter/OutputFormatter.php index bc47f6e10..c914a1246 100644 --- a/Formatter/OutputFormatter.php +++ b/Formatter/OutputFormatter.php @@ -23,7 +23,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface { private bool $decorated; private array $styles = []; - private OutputFormatterStyleStack $styleStack; + private $styleStack; public function __clone() { diff --git a/Formatter/OutputFormatterStyle.php b/Formatter/OutputFormatterStyle.php index 9e8ea967e..0a009e962 100644 --- a/Formatter/OutputFormatterStyle.php +++ b/Formatter/OutputFormatterStyle.php @@ -20,7 +20,7 @@ */ class OutputFormatterStyle implements OutputFormatterStyleInterface { - private Color $color; + private $color; private string $foreground; private string $background; private array $options; diff --git a/Formatter/OutputFormatterStyleStack.php b/Formatter/OutputFormatterStyleStack.php index e72b641ba..b425449ef 100644 --- a/Formatter/OutputFormatterStyleStack.php +++ b/Formatter/OutputFormatterStyleStack.php @@ -24,7 +24,7 @@ class OutputFormatterStyleStack implements ResetInterface */ private array $styles = []; - private OutputFormatterStyleInterface $emptyStyle; + private $emptyStyle; public function __construct(OutputFormatterStyleInterface $emptyStyle = null) { diff --git a/Helper/Dumper.php b/Helper/Dumper.php index 76b76c0a4..50190951b 100644 --- a/Helper/Dumper.php +++ b/Helper/Dumper.php @@ -21,9 +21,9 @@ */ final class Dumper { - private OutputInterface $output; - private ?CliDumper $dumper; - private ?ClonerInterface $cloner; + private $output; + private $dumper; + private $cloner; private \Closure $handler; public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null) diff --git a/Helper/ProgressBar.php b/Helper/ProgressBar.php index b087b4b92..72c26f2f3 100644 --- a/Helper/ProgressBar.php +++ b/Helper/ProgressBar.php @@ -47,7 +47,7 @@ final class ProgressBar private float $lastWriteTime = 0; private float $minSecondsBetweenRedraws = 0; private float $maxSecondsBetweenRedraws = 1; - private OutputInterface $output; + private $output; private int $step = 0; private ?int $max = null; private int $startTime; @@ -56,9 +56,9 @@ final class ProgressBar private int $formatLineCount; private array $messages = []; private bool $overwrite = true; - private Terminal $terminal; + private $terminal; private ?string $previousMessage = null; - private Cursor $cursor; + private $cursor; private static array $formatters; private static array $formats; diff --git a/Helper/ProgressIndicator.php b/Helper/ProgressIndicator.php index 9ca24e942..c746f9b92 100644 --- a/Helper/ProgressIndicator.php +++ b/Helper/ProgressIndicator.php @@ -31,7 +31,7 @@ class ProgressIndicator 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)', ]; - private OutputInterface $output; + private $output; private int $startTime; private ?string $format = null; private ?string $message = null; diff --git a/Helper/Table.php b/Helper/Table.php index 94abf74d1..2e87ed9c7 100644 --- a/Helper/Table.php +++ b/Helper/Table.php @@ -43,8 +43,8 @@ class Table private bool $horizontal = false; private array $effectiveColumnWidths = []; private int $numberOfColumns; - private OutputInterface $output; - private TableStyle $style; + private $output; + private $style; private array $columnStyles = []; private array $columnWidths = []; private array $columnMaxWidths = []; diff --git a/Input/InputDefinition.php b/Input/InputDefinition.php index f4b14a1c8..cb270d81f 100644 --- a/Input/InputDefinition.php +++ b/Input/InputDefinition.php @@ -30,8 +30,8 @@ class InputDefinition { private array $arguments = []; private int $requiredCount = 0; - private ?InputArgument $lastArrayArgument = null; - private ?InputArgument $lastOptionalArgument = null; + private $lastArrayArgument = null; + private $lastOptionalArgument = null; private array $options = []; private array $negations = []; private array $shortcuts = []; diff --git a/Logger/ConsoleLogger.php b/Logger/ConsoleLogger.php index 8d028ac8e..61a782150 100644 --- a/Logger/ConsoleLogger.php +++ b/Logger/ConsoleLogger.php @@ -29,7 +29,7 @@ class ConsoleLogger extends AbstractLogger public const INFO = 'info'; public const ERROR = 'error'; - private OutputInterface $output; + private $output; private array $verbosityLevelMap = [ LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, diff --git a/Output/ConsoleOutput.php b/Output/ConsoleOutput.php index 1ed7f20a2..3326cdf23 100644 --- a/Output/ConsoleOutput.php +++ b/Output/ConsoleOutput.php @@ -29,7 +29,7 @@ */ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface { - private OutputInterface $stderr; + private $stderr; private array $consoleSectionOutputs = []; /** diff --git a/Output/ConsoleSectionOutput.php b/Output/ConsoleSectionOutput.php index d4c2f20c7..92dca7968 100644 --- a/Output/ConsoleSectionOutput.php +++ b/Output/ConsoleSectionOutput.php @@ -24,7 +24,7 @@ class ConsoleSectionOutput extends StreamOutput private array $content = []; private int $lines = 0; private array $sections; - private Terminal $terminal; + private $terminal; /** * @param resource $stream diff --git a/Output/NullOutput.php b/Output/NullOutput.php index 768207f0e..87214ec49 100644 --- a/Output/NullOutput.php +++ b/Output/NullOutput.php @@ -24,7 +24,7 @@ */ class NullOutput implements OutputInterface { - private NullOutputFormatter $formatter; + private $formatter; /** * {@inheritdoc} diff --git a/Output/Output.php b/Output/Output.php index c337e113f..58c1837b7 100644 --- a/Output/Output.php +++ b/Output/Output.php @@ -30,7 +30,7 @@ abstract class Output implements OutputInterface { private int $verbosity; - private OutputFormatterInterface $formatter; + private $formatter; /** * @param int|null $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) diff --git a/Style/OutputStyle.php b/Style/OutputStyle.php index 1338f04c6..0b2ded36c 100644 --- a/Style/OutputStyle.php +++ b/Style/OutputStyle.php @@ -23,7 +23,7 @@ */ abstract class OutputStyle implements OutputInterface, StyleInterface { - private OutputInterface $output; + private $output; public function __construct(OutputInterface $output) { diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index 58640ab5f..78af16670 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -38,12 +38,12 @@ class SymfonyStyle extends OutputStyle { public const MAX_LINE_LENGTH = 120; - private InputInterface $input; - private OutputInterface $output; - private SymfonyQuestionHelper $questionHelper; - private ProgressBar $progressBar; + private $input; + private $output; + private $questionHelper; + private $progressBar; private int $lineLength; - private TrimmedBufferOutput $bufferedOutput; + private $bufferedOutput; public function __construct(InputInterface $input, OutputInterface $output) { diff --git a/Tester/ApplicationTester.php b/Tester/ApplicationTester.php index ffa21cba4..0404020c6 100644 --- a/Tester/ApplicationTester.php +++ b/Tester/ApplicationTester.php @@ -28,7 +28,7 @@ class ApplicationTester { use TesterTrait; - private Application $application; + private $application; public function __construct(Application $application) { diff --git a/Tester/CommandTester.php b/Tester/CommandTester.php index 2ff813b7d..f6ee4b730 100644 --- a/Tester/CommandTester.php +++ b/Tester/CommandTester.php @@ -24,7 +24,7 @@ class CommandTester { use TesterTrait; - private Command $command; + private $command; public function __construct(Command $command) { diff --git a/Tester/TesterTrait.php b/Tester/TesterTrait.php index 0d2a371e4..b238f958b 100644 --- a/Tester/TesterTrait.php +++ b/Tester/TesterTrait.php @@ -23,10 +23,10 @@ */ trait TesterTrait { - private StreamOutput $output; + private $output; private array $inputs = []; private bool $captureStreamsIndependently = false; - private InputInterface $input; + private $input; private int $statusCode; /** From 9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 9 Dec 2021 12:22:43 +0100 Subject: [PATCH 4/4] Fix polyfill-php73 requirement --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2a7b429ac..9a565068c 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "php": ">=7.2.5", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", "symfony/string": "^5.1|^6.0"