From 1b95e23435ab025895d9ff4c2d867aef06aaeab7 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 7 Apr 2021 17:14:41 +0200 Subject: [PATCH 1/3] [CS] Replace easy occurences of ?: with ?? --- Formatter/OutputFormatterStyleStack.php | 2 +- Output/Output.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Formatter/OutputFormatterStyleStack.php b/Formatter/OutputFormatterStyleStack.php index 33f7d5222..fc48dc0e1 100644 --- a/Formatter/OutputFormatterStyleStack.php +++ b/Formatter/OutputFormatterStyleStack.php @@ -28,7 +28,7 @@ class OutputFormatterStyleStack implements ResetInterface public function __construct(OutputFormatterStyleInterface $emptyStyle = null) { - $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle(); + $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle(); $this->reset(); } diff --git a/Output/Output.php b/Output/Output.php index 9dd765113..857248133 100644 --- a/Output/Output.php +++ b/Output/Output.php @@ -40,7 +40,7 @@ abstract class Output implements OutputInterface public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) { $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity; - $this->formatter = $formatter ?: new OutputFormatter(); + $this->formatter = $formatter ?? new OutputFormatter(); $this->formatter->setDecorated($decorated); } From d53ddf9bafb578242cc3a2c53d894f210739e2c4 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 7 Apr 2021 18:12:22 +0200 Subject: [PATCH 2/3] [PHPDoc] Fix some union type cases --- Descriptor/Descriptor.php | 10 ---------- Descriptor/TextDescriptor.php | 2 +- Helper/QuestionHelper.php | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Descriptor/Descriptor.php b/Descriptor/Descriptor.php index d25a708e4..9c3878d1e 100644 --- a/Descriptor/Descriptor.php +++ b/Descriptor/Descriptor.php @@ -72,36 +72,26 @@ protected function write($content, $decorated = false) /** * Describes an InputArgument instance. - * - * @return string|mixed */ abstract protected function describeInputArgument(InputArgument $argument, array $options = []); /** * Describes an InputOption instance. - * - * @return string|mixed */ abstract protected function describeInputOption(InputOption $option, array $options = []); /** * Describes an InputDefinition instance. - * - * @return string|mixed */ abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []); /** * Describes a Command instance. - * - * @return string|mixed */ abstract protected function describeCommand(Command $command, array $options = []); /** * Describes an Application instance. - * - * @return string|mixed */ abstract protected function describeApplication(Application $application, array $options = []); } diff --git a/Descriptor/TextDescriptor.php b/Descriptor/TextDescriptor.php index 1db3686be..220bd2e68 100644 --- a/Descriptor/TextDescriptor.php +++ b/Descriptor/TextDescriptor.php @@ -298,7 +298,7 @@ private function formatDefaultValue($default): string } /** - * @param (Command|string)[] $commands + * @param array $commands */ private function getColumnWidth(array $commands): int { diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index 6dde580cf..f1a3c4b5d 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -97,7 +97,7 @@ public static function disableStty() /** * Asks the question to the user. * - * @return bool|mixed|string|null + * @return mixed * * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden */ From 36bbd079b69b94bcc9c9c9e1e37ca3b1e7971625 Mon Sep 17 00:00:00 2001 From: Markus Staab <47448731+clxmstaab@users.noreply.github.com> Date: Fri, 16 Apr 2021 09:18:02 +0200 Subject: [PATCH 3/3] [Console] : added phpdocs to InputOption constants --- Input/InputOption.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Input/InputOption.php b/Input/InputOption.php index a8e956db5..5e48f88b8 100644 --- a/Input/InputOption.php +++ b/Input/InputOption.php @@ -21,9 +21,24 @@ */ class InputOption { + /** + * Do not accept input for the option (e.g. --yell). This is the default behavior of options. + */ public const VALUE_NONE = 1; + + /** + * A value must be passed when the option is used (e.g. --iterations=5 or -i5). + */ public const VALUE_REQUIRED = 2; + + /** + * The option may or may not have a value (e.g. --yell or --yell=loud). + */ public const VALUE_OPTIONAL = 4; + + /** + * The option accepts multiple values (e.g. --dir=/foo --dir=/bar). + */ public const VALUE_IS_ARRAY = 8; private $name;