diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 78b430ec32dfd..6334dae0b2f08 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -41,9 +41,9 @@ use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Component\ErrorCatcher\ErrorHandler; use Symfony\Component\ErrorCatcher\Exception\FatalThrowableError; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; /** * An Application is the container for a collection of commands. @@ -78,10 +78,6 @@ class Application private $singleCommand = false; private $initialized; - /** - * @param string $name The name of the application - * @param string $version The version of the application - */ public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN') { $this->name = $name; @@ -342,12 +338,10 @@ public function areExceptionsCaught() /** * Sets whether to catch exceptions or not during commands execution. - * - * @param bool $boolean Whether to catch exceptions or not during commands execution */ - public function setCatchExceptions($boolean) + public function setCatchExceptions(bool $boolean) { - $this->catchExceptions = (bool) $boolean; + $this->catchExceptions = $boolean; } /** @@ -362,12 +356,10 @@ public function isAutoExitEnabled() /** * Sets whether to automatically exit after a command execution or not. - * - * @param bool $boolean Whether to automatically exit after a command execution or not */ - public function setAutoExit($boolean) + public function setAutoExit(bool $boolean) { - $this->autoExit = (bool) $boolean; + $this->autoExit = $boolean; } /** @@ -382,10 +374,8 @@ public function getName() /** * Sets the application name. - * - * @param string $name The application name - */ - public function setName($name) + **/ + public function setName(string $name) { $this->name = $name; } @@ -402,10 +392,8 @@ public function getVersion() /** * Sets the application version. - * - * @param string $version The application version */ - public function setVersion($version) + public function setVersion(string $version) { $this->version = $version; } @@ -431,11 +419,9 @@ public function getLongVersion() /** * Registers a new command. * - * @param string $name The command name - * * @return Command The newly created command */ - public function register($name) + public function register(string $name) { return $this->add(new Command($name)); } @@ -494,13 +480,11 @@ public function add(Command $command) /** * Returns a registered command by name or alias. * - * @param string $name The command name or alias - * * @return Command A Command object * * @throws CommandNotFoundException When given command name does not exist */ - public function get($name) + public function get(string $name) { $this->init(); @@ -525,11 +509,9 @@ public function get($name) /** * Returns true if the command exists, false otherwise. * - * @param string $name The command name or alias - * * @return bool true if the command exists, false otherwise */ - public function has($name) + public function has(string $name) { $this->init(); @@ -560,13 +542,11 @@ public function getNamespaces() /** * Finds a registered namespace by a name or an abbreviation. * - * @param string $namespace A namespace or abbreviation to search for - * * @return string A registered namespace * * @throws NamespaceNotFoundException When namespace is incorrect or ambiguous */ - public function findNamespace($namespace) + public function findNamespace(string $namespace) { $allNamespaces = $this->getNamespaces(); $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace); @@ -602,13 +582,11 @@ public function findNamespace($namespace) * Contrary to get, this command tries to find the best * match if you give it an abbreviation of a name or alias. * - * @param string $name A command name or a command alias - * * @return Command A Command instance * * @throws CommandNotFoundException When command name is incorrect or ambiguous */ - public function find($name) + public function find(string $name) { $this->init(); @@ -694,11 +672,9 @@ public function find($name) * * The array keys are the full names and the values the command instances. * - * @param string $namespace A namespace name - * * @return Command[] An array of Command instances */ - public function all($namespace = null) + public function all(string $namespace = null) { $this->init(); @@ -738,11 +714,9 @@ public function all($namespace = null) /** * Returns an array of possible abbreviations given a set of names. * - * @param array $names An array of names - * - * @return array An array of abbreviations + * @return string[][] An array of abbreviations */ - public static function getAbbreviations($names) + public static function getAbbreviations(array $names) { $abbrevs = []; foreach ($names as $name) { @@ -1020,11 +994,9 @@ protected function getDefaultHelperSet() /** * Returns abbreviated suggestions in string format. * - * @param array $abbrevs Abbreviated suggestions to convert - * * @return string A formatted string of abbreviated suggestions */ - private function getAbbreviationSuggestions($abbrevs) + private function getAbbreviationSuggestions(array $abbrevs) { return ' '.implode("\n ", $abbrevs); } @@ -1034,12 +1006,9 @@ private function getAbbreviationSuggestions($abbrevs) * * This method is not part of public API and should not be used directly. * - * @param string $name The full name of the command - * @param string $limit The maximum number of parts of the namespace - * * @return string The namespace of the command */ - public function extractNamespace($name, $limit = null) + public function extractNamespace(string $name, int $limit = null) { $parts = explode(':', $name); array_pop($parts); @@ -1051,12 +1020,9 @@ public function extractNamespace($name, $limit = null) * Finds alternative of $name among $collection, * if nothing is found in $collection, try in $abbrevs. * - * @param string $name The string - * @param iterable $collection The collection - * * @return string[] A sorted array of similar string */ - private function findAlternatives($name, $collection) + private function findAlternatives(string $name, iterable $collection) { $threshold = 1e3; $alternatives = []; @@ -1101,12 +1067,9 @@ private function findAlternatives($name, $collection) /** * Sets the default Command name. * - * @param string $commandName The Command name - * @param bool $isSingleCommand Set to true if there is only one command in this application - * * @return self */ - public function setDefaultCommand($commandName, $isSingleCommand = false) + public function setDefaultCommand(string $commandName, bool $isSingleCommand = false) { $this->defaultCommand = $commandName; @@ -1161,11 +1124,9 @@ private function splitStringByWidth($string, $width) /** * Returns all namespaces of the command name. * - * @param string $name The full name of the command - * * @return string[] The namespaces of the command */ - private function extractAllNamespaces($name) + private function extractAllNamespaces(string $name) { // -1 as third argument is needed to skip the command short name when exploding $parts = explode(':', $name, -1); diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 18d683de935a3..351a745e40dd9 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -293,7 +293,7 @@ public function setCode(callable $code) * * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments */ - public function mergeApplicationDefinition($mergeArgs = true) + public function mergeApplicationDefinition(bool $mergeArgs = true) { if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) { return; @@ -360,16 +360,14 @@ public function getNativeDefinition() /** * Adds an argument. * - * @param string $name The argument name - * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param string $description A description text - * @param string|string[]|null $default The default value (for InputArgument::OPTIONAL mode only) + * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL + * @param string|string[]|null $default The default value (for InputArgument::OPTIONAL mode only) * * @throws InvalidArgumentException When argument mode is not valid * * @return $this */ - public function addArgument($name, $mode = null, $description = '', $default = null) + public function addArgument(string $name, int $mode = null, string $description = '', $default = null) { $this->definition->addArgument(new InputArgument($name, $mode, $description, $default)); @@ -379,17 +377,15 @@ public function addArgument($name, $mode = null, $description = '', $default = n /** * Adds an option. * - * @param string $name The option name - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE) + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants + * @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible * * @return $this */ - public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null) + public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null) { $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default)); @@ -404,13 +400,11 @@ public function addOption($name, $shortcut = null, $mode = null, $description = * * $command->setName('foo:bar'); * - * @param string $name The command name - * * @return $this * * @throws InvalidArgumentException When the name is invalid */ - public function setName($name) + public function setName(string $name) { $this->validateName($name); @@ -427,11 +421,9 @@ public function setName($name) * * PHP 5.5+ or the proctitle PECL library is required * - * @param string $title The process title - * * @return $this */ - public function setProcessTitle($title) + public function setProcessTitle(string $title) { $this->processTitle = $title; @@ -453,9 +445,9 @@ public function getName() * * @return Command The current instance */ - public function setHidden($hidden) + public function setHidden(bool $hidden) { - $this->hidden = (bool) $hidden; + $this->hidden = $hidden; return $this; } @@ -471,11 +463,9 @@ public function isHidden() /** * Sets the description for the command. * - * @param string $description The description for the command - * * @return $this */ - public function setDescription($description) + public function setDescription(string $description) { $this->description = $description; @@ -495,11 +485,9 @@ public function getDescription() /** * Sets the help for the command. * - * @param string $help The help for the command - * * @return $this */ - public function setHelp($help) + public function setHelp(string $help) { $this->help = $help; @@ -548,12 +536,8 @@ public function getProcessedHelp() * * @throws InvalidArgumentException When an alias is invalid */ - public function setAliases($aliases) + public function setAliases(iterable $aliases) { - if (!\is_array($aliases) && !$aliases instanceof \Traversable) { - throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); - } - foreach ($aliases as $alias) { $this->validateName($alias); } @@ -580,7 +564,7 @@ public function getAliases() * * @return string The synopsis */ - public function getSynopsis($short = false) + public function getSynopsis(bool $short = false) { $key = $short ? 'short' : 'long'; @@ -592,13 +576,11 @@ public function getSynopsis($short = false) } /** - * Add a command usage example. - * - * @param string $usage The usage, it'll be prefixed with the command name + * Add a command usage example, it'll be prefixed with the command name. * * @return $this */ - public function addUsage($usage) + public function addUsage(string $usage) { if (0 !== strpos($usage, $this->name)) { $usage = sprintf('%s %s', $this->name, $usage); @@ -622,14 +604,12 @@ public function getUsages() /** * Gets a helper instance by name. * - * @param string $name The helper name - * * @return mixed The helper value * * @throws LogicException if no HelperSet is defined * @throws InvalidArgumentException if the helper is not defined */ - public function getHelper($name) + public function getHelper(string $name) { if (null === $this->helperSet) { 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)); diff --git a/src/Symfony/Component/Console/Command/LockableTrait.php b/src/Symfony/Component/Console/Command/LockableTrait.php index f4ebe45bf37c7..55b6b7d5dffe7 100644 --- a/src/Symfony/Component/Console/Command/LockableTrait.php +++ b/src/Symfony/Component/Console/Command/LockableTrait.php @@ -32,7 +32,7 @@ trait LockableTrait * * @return bool */ - private function lock($name = null, $blocking = false) + private function lock(string $name = null, bool $blocking = false) { if (!class_exists(SemaphoreStore::class)) { throw new LogicException('To enable the locking feature you must install the symfony/lock component.'); diff --git a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php index 9462996f6d2af..d4f44e88fd974 100644 --- a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php +++ b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Symfony\Component\Console\Command\Command; @@ -13,22 +22,18 @@ interface CommandLoaderInterface /** * Loads a command. * - * @param string $name - * * @return Command * * @throws CommandNotFoundException */ - public function get($name); + public function get(string $name); /** * Checks if a command exists. * - * @param string $name - * * @return bool */ - public function has($name); + public function has(string $name); /** * @return string[] All registered command names diff --git a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php index 753ad0fb705c2..bf76a857be8e8 100644 --- a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Psr\Container\ContainerInterface; @@ -28,7 +37,7 @@ public function __construct(ContainerInterface $container, array $commandMap) /** * {@inheritdoc} */ - public function get($name) + public function get(string $name) { if (!$this->has($name)) { throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); @@ -40,7 +49,7 @@ public function get($name) /** * {@inheritdoc} */ - public function has($name) + public function has(string $name) { return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]); } diff --git a/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php index d9c2055710968..7e2db346471a2 100644 --- a/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php @@ -33,7 +33,7 @@ public function __construct(array $factories) /** * {@inheritdoc} */ - public function has($name) + public function has(string $name) { return isset($this->factories[$name]); } @@ -41,7 +41,7 @@ public function has($name) /** * {@inheritdoc} */ - public function get($name) + public function get(string $name) { if (!isset($this->factories[$name])) { throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php index 03bfcfcda4407..e38996caab119 100644 --- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php +++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php @@ -75,13 +75,11 @@ public function getCommands() } /** - * @param string $name - * * @return Command * * @throws CommandNotFoundException */ - public function getCommand($name) + public function getCommand(string $name) { if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name)); diff --git a/src/Symfony/Component/Console/Descriptor/Descriptor.php b/src/Symfony/Component/Console/Descriptor/Descriptor.php index d25a708e479ee..df85e38105133 100644 --- a/src/Symfony/Component/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Component/Console/Descriptor/Descriptor.php @@ -61,11 +61,8 @@ public function describe(OutputInterface $output, $object, array $options = []) /** * Writes content to output. - * - * @param string $content - * @param bool $decorated */ - protected function write($content, $decorated = false) + protected function write(string $content, bool $decorated = false) { $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); } diff --git a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php index e6245778f58d5..92f5efdd9b3fe 100644 --- a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php @@ -44,7 +44,7 @@ public function describe(OutputInterface $output, $object, array $options = []) /** * {@inheritdoc} */ - protected function write($content, $decorated = true) + protected function write(string $content, bool $decorated = true) { parent::write($content, $decorated); } @@ -92,7 +92,9 @@ protected function describeInputDefinition(InputDefinition $definition, array $o $this->write('### Arguments'); foreach ($definition->getArguments() as $argument) { $this->write("\n\n"); - $this->write($this->describeInputArgument($argument)); + if (null !== $describeInputArgument = $this->describeInputArgument($argument)) { + $this->write($describeInputArgument); + } } } @@ -104,7 +106,9 @@ protected function describeInputDefinition(InputDefinition $definition, array $o $this->write('### Options'); foreach ($definition->getOptions() as $option) { $this->write("\n\n"); - $this->write($this->describeInputOption($option)); + if (null !== $describeInputOption = $this->describeInputOption($option)) { + $this->write($describeInputOption); + } } } } @@ -163,7 +167,9 @@ protected function describeApplication(Application $application, array $options foreach ($description->getCommands() as $command) { $this->write("\n\n"); - $this->write($this->describeCommand($command)); + if (null !== $describeCommand = $this->describeCommand($command)) { + $this->write($describeCommand); + } } } diff --git a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php index f5202a330bbb0..e1709d7846b61 100644 --- a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php @@ -81,12 +81,9 @@ public function getCommandDocument(Command $command) } /** - * @param Application $application - * @param string|null $namespace - * * @return \DOMDocument */ - public function getApplicationDocument(Application $application, $namespace = null) + public function getApplicationDocument(Application $application, string $namespace = null) { $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->appendChild($rootXml = $dom->createElement('symfony')); diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 83f16d7731566..9cca9b7537a56 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -28,11 +28,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface /** * Escapes "<" special char in given text. * - * @param string $text Text to escape - * * @return string Escaped text */ - public static function escape($text) + public static function escape(string $text) { $text = preg_replace('/([^\\\\]?) FormatterStyle" instances + * @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances */ public function __construct(bool $decorated = false, array $styles = []) { @@ -85,9 +80,9 @@ public function __construct(bool $decorated = false, array $styles = []) /** * {@inheritdoc} */ - public function setDecorated($decorated) + public function setDecorated(bool $decorated) { - $this->decorated = (bool) $decorated; + $this->decorated = $decorated; } /** @@ -101,7 +96,7 @@ public function isDecorated() /** * {@inheritdoc} */ - public function setStyle($name, OutputFormatterStyleInterface $style) + public function setStyle(string $name, OutputFormatterStyleInterface $style) { $this->styles[strtolower($name)] = $style; } @@ -109,7 +104,7 @@ public function setStyle($name, OutputFormatterStyleInterface $style) /** * {@inheritdoc} */ - public function hasStyle($name) + public function hasStyle(string $name) { return isset($this->styles[strtolower($name)]); } @@ -117,7 +112,7 @@ public function hasStyle($name) /** * {@inheritdoc} */ - public function getStyle($name) + public function getStyle(string $name) { if (!$this->hasStyle($name)) { throw new InvalidArgumentException(sprintf('Undefined style: %s', $name)); @@ -129,15 +124,15 @@ public function getStyle($name) /** * {@inheritdoc} */ - public function format($message) + public function format(?string $message) { - return $this->formatAndWrap((string) $message, 0); + return $this->formatAndWrap($message, 0); } /** * {@inheritdoc} */ - public function formatAndWrap(string $message, int $width) + public function formatAndWrap(?string $message, int $width) { $offset = 0; $output = ''; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php index 281e240c5f70d..8c50d41964d76 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php @@ -20,10 +20,8 @@ interface OutputFormatterInterface { /** * Sets the decorated flag. - * - * @param bool $decorated Whether to decorate the messages or not */ - public function setDecorated($decorated); + public function setDecorated(bool $decorated); /** * Gets the decorated flag. @@ -34,38 +32,27 @@ public function isDecorated(); /** * Sets a new style. - * - * @param string $name The style name - * @param OutputFormatterStyleInterface $style The style instance */ - public function setStyle($name, OutputFormatterStyleInterface $style); + public function setStyle(string $name, OutputFormatterStyleInterface $style); /** * Checks if output formatter has style with specified name. * - * @param string $name - * * @return bool */ - public function hasStyle($name); + public function hasStyle(string $name); /** * Gets style options from style with specified name. * - * @param string $name - * * @return OutputFormatterStyleInterface * * @throws \InvalidArgumentException When style isn't defined */ - public function getStyle($name); + public function getStyle(string $name); /** * Formats a message according to the given styles. - * - * @param string $message The message to style - * - * @return string The styled message */ - public function format($message); + public function format(?string $message); } diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index 655bdd083e50e..58f9f05ae277e 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -77,13 +77,9 @@ public function __construct(string $foreground = null, string $background = null } /** - * Sets style foreground color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ - public function setForeground($color = null) + public function setForeground(string $color = null) { if (null === $color) { $this->foreground = null; @@ -99,13 +95,9 @@ public function setForeground($color = null) } /** - * Sets style background color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ - public function setBackground($color = null) + public function setBackground(string $color = null) { if (null === $color) { $this->background = null; @@ -126,13 +118,9 @@ public function setHref(string $url): void } /** - * Sets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ - public function setOption($option) + public function setOption(string $option) { if (!isset(static::$availableOptions[$option])) { throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); @@ -144,13 +132,9 @@ public function setOption($option) } /** - * Unsets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ - public function unsetOption($option) + public function unsetOption(string $option) { if (!isset(static::$availableOptions[$option])) { throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); @@ -175,13 +159,9 @@ public function setOptions(array $options) } /** - * Applies the style to a given text. - * - * @param string $text The text to style - * - * @return string + * {@inheritdoc} */ - public function apply($text) + public function apply(string $text) { $setCodes = []; $unsetCodes = []; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index 4c7dc4134d723..b30560d22e161 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -20,31 +20,23 @@ interface OutputFormatterStyleInterface { /** * Sets style foreground color. - * - * @param string $color The color name */ - public function setForeground($color = null); + public function setForeground(string $color = null); /** * Sets style background color. - * - * @param string $color The color name */ - public function setBackground($color = null); + public function setBackground(string $color = null); /** * Sets some specific style option. - * - * @param string $option The option name */ - public function setOption($option); + public function setOption(string $option); /** * Unsets some specific style option. - * - * @param string $option The option name */ - public function unsetOption($option); + public function unsetOption(string $option); /** * Sets multiple style options at once. @@ -54,9 +46,7 @@ public function setOptions(array $options); /** * Applies the style to a given text. * - * @param string $text The text to style - * * @return string */ - public function apply($text); + public function apply(string $text); } diff --git a/src/Symfony/Component/Console/Formatter/WrappableOutputFormatterInterface.php b/src/Symfony/Component/Console/Formatter/WrappableOutputFormatterInterface.php index 6694053f057ea..42319ee5543f0 100644 --- a/src/Symfony/Component/Console/Formatter/WrappableOutputFormatterInterface.php +++ b/src/Symfony/Component/Console/Formatter/WrappableOutputFormatterInterface.php @@ -21,5 +21,5 @@ interface WrappableOutputFormatterInterface extends OutputFormatterInterface /** * Formats a message according to the given styles, wrapping at `$width` (0 means no wrapping). */ - public function formatAndWrap(string $message, int $width); + public function formatAndWrap(?string $message, int $width); } diff --git a/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php b/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php index 16d117553a1cb..2396626810de4 100644 --- a/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php +++ b/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php @@ -27,13 +27,9 @@ class DebugFormatterHelper extends Helper /** * Starts a debug formatting session. * - * @param string $id The id of the formatting session - * @param string $message The message to display - * @param string $prefix The prefix to use - * * @return string */ - public function start($id, $message, $prefix = 'RUN') + public function start(string $id, string $message, string $prefix = 'RUN') { $this->started[$id] = ['border' => ++$this->count % \count($this->colors)]; @@ -43,15 +39,9 @@ public function start($id, $message, $prefix = 'RUN') /** * Adds progress to a formatting session. * - * @param string $id The id of the formatting session - * @param string $buffer The message to display - * @param bool $error Whether to consider the buffer as error - * @param string $prefix The prefix for output - * @param string $errorPrefix The prefix for error output - * * @return string */ - public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR') + public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR') { $message = ''; @@ -85,14 +75,9 @@ public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPr /** * Stops a formatting session. * - * @param string $id The id of the formatting session - * @param string $message The message to display - * @param bool $successful Whether to consider the result as success - * @param string $prefix The prefix for the end output - * * @return string */ - public function stop($id, $message, $successful, $prefix = 'RES') + public function stop(string $id, string $message, bool $successful, string $prefix = 'RES') { $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : ''; @@ -108,11 +93,9 @@ public function stop($id, $message, $successful, $prefix = 'RES') } /** - * @param string $id The id of the formatting session - * * @return string */ - private function getBorder($id) + private function getBorder(string $id) { return sprintf(' ', $this->colors[$this->started[$id]['border']]); } diff --git a/src/Symfony/Component/Console/Helper/FormatterHelper.php b/src/Symfony/Component/Console/Helper/FormatterHelper.php index 4ad63856dcd5c..75c9b613f14f6 100644 --- a/src/Symfony/Component/Console/Helper/FormatterHelper.php +++ b/src/Symfony/Component/Console/Helper/FormatterHelper.php @@ -23,13 +23,9 @@ class FormatterHelper extends Helper /** * Formats a message within a section. * - * @param string $section The section name - * @param string $message The message - * @param string $style The style to apply to the section - * * @return string The format section */ - public function formatSection($section, $message, $style = 'info') + public function formatSection(string $section, string $message, string $style = 'info') { return sprintf('<%s>[%s] %s', $style, $section, $style, $message); } @@ -38,12 +34,10 @@ public function formatSection($section, $message, $style = 'info') * Formats a message as a block of text. * * @param string|array $messages The message to write in the block - * @param string $style The style to apply to the whole block - * @param bool $large Whether to return a large block * * @return string The formatter message */ - public function formatBlock($messages, $style, $large = false) + public function formatBlock($messages, string $style, bool $large = false) { if (!\is_array($messages)) { $messages = [$messages]; @@ -75,13 +69,9 @@ public function formatBlock($messages, $style, $large = false) /** * Truncates a message to the given length. * - * @param string $message - * @param int $length - * @param string $suffix - * * @return string */ - public function truncate($message, $length, $suffix = '...') + public function truncate(string $message, int $length, string $suffix = '...') { $computedLength = $length - $this->strlen($suffix); diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index 0ddddf6bc5023..e52e31515e968 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -41,11 +41,9 @@ public function getHelperSet() /** * Returns the length of a string, using mb_strwidth if it is available. * - * @param string $string The string to check its length - * * @return int The length of the string */ - public static function strlen($string) + public static function strlen(?string $string) { if (false === $encoding = mb_detect_encoding($string, null, true)) { return \strlen($string); @@ -57,13 +55,9 @@ public static function strlen($string) /** * Returns the subset of a string, using mb_substr if it is available. * - * @param string $string String to subset - * @param int $from Start offset - * @param int|null $length Length to read - * * @return string The string subset */ - public static function substr($string, $from, $length = null) + public static function substr(string $string, int $from, int $length = null) { if (false === $encoding = mb_detect_encoding($string, null, true)) { return substr($string, $from, $length); @@ -101,7 +95,7 @@ public static function formatTime($secs) } } - public static function formatMemory($memory) + public static function formatMemory(int $memory) { if ($memory >= 1024 * 1024 * 1024) { return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024); diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index c73fecd4751e3..5c08a7606d289 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -37,13 +37,7 @@ public function __construct(array $helpers = []) } } - /** - * Sets a helper. - * - * @param HelperInterface $helper The helper instance - * @param string $alias An alias - */ - public function set(HelperInterface $helper, $alias = null) + public function set(HelperInterface $helper, string $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { @@ -56,11 +50,9 @@ public function set(HelperInterface $helper, $alias = null) /** * Returns true if the helper if defined. * - * @param string $name The helper name - * * @return bool true if the helper is defined, false otherwise */ - public function has($name) + public function has(string $name) { return isset($this->helpers[$name]); } @@ -68,13 +60,11 @@ public function has($name) /** * Gets a helper value. * - * @param string $name The helper name - * * @return HelperInterface The helper instance * * @throws InvalidArgumentException if the helper is not defined */ - public function get($name) + public function get(string $name) { if (!$this->has($name)) { throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); diff --git a/src/Symfony/Component/Console/Helper/ProcessHelper.php b/src/Symfony/Component/Console/Helper/ProcessHelper.php index fbd7d4baf4f39..3bbfc540a1d0e 100644 --- a/src/Symfony/Component/Console/Helper/ProcessHelper.php +++ b/src/Symfony/Component/Console/Helper/ProcessHelper.php @@ -28,16 +28,13 @@ class ProcessHelper extends Helper /** * Runs an external process. * - * @param OutputInterface $output An OutputInterface instance - * @param array|Process $cmd An instance of Process or an array of the command and arguments - * @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 int $verbosity The threshold for verbosity + * @param array|Process $cmd An instance of Process or an array of the command and arguments + * @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 */ - public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process + public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); @@ -91,11 +88,9 @@ 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 OutputInterface $output An OutputInterface instance - * @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 string|Process $cmd An instance of Process or a command to run + * @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 * @@ -103,7 +98,7 @@ public function run(OutputInterface $output, $cmd, $error = null, callable $call * * @see run() */ - public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null): Process + public function mustRun(OutputInterface $output, $cmd, string $error = null, callable $callback = null): Process { $process = $this->run($output, $cmd, $error, $callback); @@ -116,10 +111,6 @@ public function mustRun(OutputInterface $output, $cmd, $error = null, callable $ /** * Wraps a Process callback to add debugging output. - * - * @param OutputInterface $output An OutputInterface interface - * @param Process $process The Process - * @param callable|null $callback A PHP callable */ public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable { diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php index 301be27ea4317..6d3954f2310e4 100644 --- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php +++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php @@ -34,10 +34,8 @@ class ProgressIndicator private static $formats; /** - * @param OutputInterface $output - * @param string|null $format Indicator format - * @param int $indicatorChangeInterval Change interval in milliseconds - * @param array|null $indicatorValues Animated indicator characters + * @param int $indicatorChangeInterval Change interval in milliseconds + * @param array|null $indicatorValues Animated indicator characters */ public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null) { @@ -65,10 +63,8 @@ public function __construct(OutputInterface $output, string $format = null, int /** * Sets the current indicator message. - * - * @param string|null $message */ - public function setMessage($message) + public function setMessage(?string $message) { $this->message = $message; @@ -80,7 +76,7 @@ public function setMessage($message) * * @param $message */ - public function start($message) + public function start(string $message) { if ($this->started) { throw new LogicException('Progress indicator already started.'); @@ -125,7 +121,7 @@ public function advance() * * @param $message */ - public function finish($message) + public function finish(string $message) { if (!$this->started) { throw new LogicException('Progress indicator has not yet been started.'); @@ -140,11 +136,9 @@ public function finish($message) /** * Gets the format for a given name. * - * @param string $name The format name - * * @return string|null A format string */ - public static function getFormatDefinition($name) + public static function getFormatDefinition(string $name) { if (!self::$formats) { self::$formats = self::initFormats(); @@ -157,11 +151,8 @@ public static function getFormatDefinition($name) * Sets a placeholder formatter for a given name. * * This method also allow you to override an existing placeholder. - * - * @param string $name The placeholder name (including the delimiter char like %) - * @param callable $callable A PHP callable */ - public static function setPlaceholderFormatterDefinition($name, $callable) + public static function setPlaceholderFormatterDefinition(string $name, callable $callable) { if (!self::$formatters) { self::$formatters = self::initPlaceholderFormatters(); @@ -171,13 +162,11 @@ public static function setPlaceholderFormatterDefinition($name, $callable) } /** - * Gets the placeholder formatter for a given name. - * - * @param string $name The placeholder name (including the delimiter char like %) + * Gets the placeholder formatter for a given name (including the delimiter char like %). * * @return callable|null A PHP callable */ - public static function getPlaceholderFormatterDefinition($name) + public static function getPlaceholderFormatterDefinition(string $name) { if (!self::$formatters) { self::$formatters = self::initPlaceholderFormatters(); diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index e6a700aa45db0..cce9feb097a58 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -331,7 +331,7 @@ function ($match) use ($ret) { return $fullChoice; } - private function mostRecentlyEnteredValue($entered) + private function mostRecentlyEnteredValue(string $entered) { // Determine the most recent value that the user entered if (false === strpos($entered, ',')) { diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index ce759953f31b4..33d1d22ed8f50 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -101,11 +101,8 @@ public function __construct(OutputInterface $output) /** * Sets a style definition. - * - * @param string $name The style name - * @param TableStyle $style A TableStyle instance */ - public static function setStyleDefinition($name, TableStyle $style) + public static function setStyleDefinition(string $name, TableStyle $style) { if (!self::$styles) { self::$styles = self::initStyles(); @@ -117,11 +114,9 @@ public static function setStyleDefinition($name, TableStyle $style) /** * Gets a style definition by name. * - * @param string $name The style name - * * @return TableStyle */ - public static function getStyleDefinition($name) + public static function getStyleDefinition(string $name) { if (!self::$styles) { self::$styles = self::initStyles(); @@ -161,15 +156,12 @@ public function getStyle() /** * Sets table column style. * - * @param int $columnIndex Column index - * @param TableStyle|string $name The style name or a TableStyle instance + * @param TableStyle|string $name The style name or a TableStyle instance * * @return $this */ - public function setColumnStyle($columnIndex, $name) + public function setColumnStyle(int $columnIndex, $name) { - $columnIndex = (int) $columnIndex; - $this->columnStyles[$columnIndex] = $this->resolveStyle($name); return $this; @@ -180,11 +172,9 @@ public function setColumnStyle($columnIndex, $name) * * If style was not set, it returns the global table style. * - * @param int $columnIndex Column index - * * @return TableStyle */ - public function getColumnStyle($columnIndex) + public function getColumnStyle(int $columnIndex) { return $this->columnStyles[$columnIndex] ?? $this->getStyle(); } @@ -192,14 +182,11 @@ public function getColumnStyle($columnIndex) /** * Sets the minimum width of a column. * - * @param int $columnIndex Column index - * @param int $width Minimum column width in characters - * * @return $this */ - public function setColumnWidth($columnIndex, $width) + public function setColumnWidth(int $columnIndex, int $width) { - $this->columnWidths[(int) $columnIndex] = (int) $width; + $this->columnWidths[$columnIndex] = $width; return $this; } @@ -207,8 +194,6 @@ public function setColumnWidth($columnIndex, $width) /** * Sets the minimum width of all columns. * - * @param array $widths - * * @return $this */ public function setColumnWidths(array $widths) diff --git a/src/Symfony/Component/Console/Helper/TableStyle.php b/src/Symfony/Component/Console/Helper/TableStyle.php index 020bce96de882..93de6082a808e 100644 --- a/src/Symfony/Component/Console/Helper/TableStyle.php +++ b/src/Symfony/Component/Console/Helper/TableStyle.php @@ -51,11 +51,9 @@ class TableStyle /** * Sets padding character, used for cell padding. * - * @param string $paddingChar - * * @return $this */ - public function setPaddingChar($paddingChar) + public function setPaddingChar(string $paddingChar) { if (!$paddingChar) { throw new LogicException('The padding char must not be empty'); @@ -89,9 +87,6 @@ public function getPaddingChar() * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ * ╚═══════════════╧══════════════════════════╧══════════════════╝ * - * - * @param string $outside Outside border char (see #1 of example) - * @param string|null $inside Inside border char (see #2 of example), equals $outside if null */ public function setHorizontalBorderChars(string $outside, string $inside = null): self { @@ -115,9 +110,6 @@ public function setHorizontalBorderChars(string $outside, string $inside = null) * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ * ╚═══════════════╧══════════════════════════╧══════════════════╝ * - * - * @param string $outside Outside border char (see #1 of example) - * @param string|null $inside Inside border char (see #2 of example), equals $outside if null */ public function setVerticalBorderChars(string $outside, string $inside = null): self { @@ -263,7 +255,7 @@ public function getCellHeaderFormat() * * @return $this */ - public function setCellRowFormat($cellRowFormat) + public function setCellRowFormat(string $cellRowFormat) { $this->cellRowFormat = $cellRowFormat; @@ -287,7 +279,7 @@ public function getCellRowFormat() * * @return $this */ - public function setCellRowContentFormat($cellRowContentFormat) + public function setCellRowContentFormat(string $cellRowContentFormat) { $this->cellRowContentFormat = $cellRowContentFormat; @@ -311,7 +303,7 @@ public function getCellRowContentFormat() * * @return $this */ - public function setBorderFormat($borderFormat) + public function setBorderFormat(string $borderFormat) { $this->borderFormat = $borderFormat; @@ -331,11 +323,9 @@ public function getBorderFormat() /** * Sets cell padding type. * - * @param int $padType STR_PAD_* - * * @return $this */ - public function setPadType($padType) + public function setPadType(int $padType) { if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index c56c20c684e80..f5ba53aebdbfe 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -43,10 +43,6 @@ class ArgvInput extends Input private $tokens; private $parsed; - /** - * @param array|null $argv An array of parameters from the CLI (in the argv format) - * @param InputDefinition|null $definition A InputDefinition instance - */ public function __construct(array $argv = null, InputDefinition $definition = null) { if (null === $argv) { @@ -90,10 +86,8 @@ protected function parse() /** * Parses a short option. - * - * @param string $token The current token */ - private function parseShortOption($token) + private function parseShortOption(string $token) { $name = substr($token, 1); @@ -112,11 +106,9 @@ private function parseShortOption($token) /** * Parses a short option set. * - * @param string $name The current token - * * @throws RuntimeException When option given doesn't exist */ - private function parseShortOptionSet($name) + private function parseShortOptionSet(string $name) { $len = \strlen($name); for ($i = 0; $i < $len; ++$i) { @@ -138,10 +130,8 @@ private function parseShortOptionSet($name) /** * Parses a long option. - * - * @param string $token The current token */ - private function parseLongOption($token) + private function parseLongOption(string $token) { $name = substr($token, 2); @@ -158,11 +148,9 @@ private function parseLongOption($token) /** * Parses an argument. * - * @param string $token The current token - * * @throws RuntimeException When too many arguments are given */ - private function parseArgument($token) + private function parseArgument(string $token) { $c = \count($this->arguments); @@ -190,12 +178,11 @@ private function parseArgument($token) /** * Adds a short option value. * - * @param string $shortcut The short option key - * @param mixed $value The value for the option + * @param mixed $value The value for the option * * @throws RuntimeException When option given doesn't exist */ - private function addShortOption($shortcut, $value) + private function addShortOption(string $shortcut, $value) { if (!$this->definition->hasShortcut($shortcut)) { throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -207,12 +194,11 @@ private function addShortOption($shortcut, $value) /** * Adds a long option value. * - * @param string $name The long option key - * @param mixed $value The value for the option + * @param mixed $value The value for the option * * @throws RuntimeException When option given doesn't exist */ - private function addLongOption($name, $value) + private function addLongOption(string $name, $value) { if (!$this->definition->hasOption($name)) { throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name)); @@ -288,7 +274,7 @@ public function getFirstArgument() /** * {@inheritdoc} */ - public function hasParameterOption($values, $onlyParams = false) + public function hasParameterOption($values, bool $onlyParams = false) { $values = (array) $values; @@ -313,7 +299,7 @@ public function hasParameterOption($values, $onlyParams = false) /** * {@inheritdoc} */ - public function getParameterOption($values, $default = false, $onlyParams = false) + public function getParameterOption($values, $default = false, bool $onlyParams = false) { $values = (array) $values; $tokens = $this->tokens; diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index 44c2f0d5c66aa..b409960440008 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -51,7 +51,7 @@ public function getFirstArgument() /** * {@inheritdoc} */ - public function hasParameterOption($values, $onlyParams = false) + public function hasParameterOption($values, bool $onlyParams = false) { $values = (array) $values; @@ -75,7 +75,7 @@ public function hasParameterOption($values, $onlyParams = false) /** * {@inheritdoc} */ - public function getParameterOption($values, $default = false, $onlyParams = false) + public function getParameterOption($values, $default = false, bool $onlyParams = false) { $values = (array) $values; @@ -143,12 +143,11 @@ protected function parse() /** * Adds a short option value. * - * @param string $shortcut The short option key - * @param mixed $value The value for the option + * @param mixed $value The value for the option * * @throws InvalidOptionException When option given doesn't exist */ - private function addShortOption($shortcut, $value) + private function addShortOption(string $shortcut, $value) { if (!$this->definition->hasShortcut($shortcut)) { throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -160,13 +159,12 @@ private function addShortOption($shortcut, $value) /** * Adds a long option value. * - * @param string $name The long option key - * @param mixed $value The value for the option + * @param mixed $value The value for the option * * @throws InvalidOptionException When option given doesn't exist * @throws InvalidOptionException When a required value is missing */ - private function addLongOption($name, $value) + private function addLongOption(string $name, $value) { if (!$this->definition->hasOption($name)) { throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name)); diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php index c1220316dcfff..8c7905db78916 100644 --- a/src/Symfony/Component/Console/Input/Input.php +++ b/src/Symfony/Component/Console/Input/Input.php @@ -88,9 +88,9 @@ public function isInteractive() /** * {@inheritdoc} */ - public function setInteractive($interactive) + public function setInteractive(bool $interactive) { - $this->interactive = (bool) $interactive; + $this->interactive = $interactive; } /** @@ -144,7 +144,7 @@ public function getOptions() /** * {@inheritdoc} */ - public function getOption($name) + public function getOption(string $name) { if (!$this->definition->hasOption($name)) { throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); @@ -156,7 +156,7 @@ public function getOption($name) /** * {@inheritdoc} */ - public function setOption($name, $value) + public function setOption(string $name, $value) { if (!$this->definition->hasOption($name)) { throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); @@ -168,7 +168,7 @@ public function setOption($name, $value) /** * {@inheritdoc} */ - public function hasOption($name) + public function hasOption(string $name) { return $this->definition->hasOption($name); } @@ -176,11 +176,9 @@ public function hasOption($name) /** * Escapes a token through escapeshellarg if it contains unsafe chars. * - * @param string $token - * * @return string */ - public function escapeToken($token) + public function escapeToken(string $token) { return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); } diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index 2189c46282264..cc10b284b2319 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -67,7 +67,7 @@ public function setDefinition(array $definition) * * @param InputArgument[] $arguments An array of InputArgument objects */ - public function setArguments($arguments = []) + public function setArguments(array $arguments = []) { $this->arguments = []; $this->requiredCount = 0; @@ -81,7 +81,7 @@ public function setArguments($arguments = []) * * @param InputArgument[] $arguments An array of InputArgument objects */ - public function addArguments($arguments = []) + public function addArguments(?array $arguments = []) { if (null !== $arguments) { foreach ($arguments as $argument) { @@ -204,7 +204,7 @@ public function getArgumentDefaults() * * @param InputOption[] $options An array of InputOption objects */ - public function setOptions($options = []) + public function setOptions(array $options = []) { $this->options = []; $this->shortcuts = []; @@ -216,7 +216,7 @@ public function setOptions($options = []) * * @param InputOption[] $options An array of InputOption objects */ - public function addOptions($options = []) + public function addOptions(array $options = []) { foreach ($options as $option) { $this->addOption($option); @@ -251,13 +251,11 @@ public function addOption(InputOption $option) /** * Returns an InputOption by name. * - * @param string $name The InputOption name - * * @return InputOption A InputOption object * * @throws InvalidArgumentException When option given doesn't exist */ - public function getOption($name) + public function getOption(string $name) { if (!$this->hasOption($name)) { throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name)); @@ -272,11 +270,9 @@ public function getOption($name) * This method can't be used to check if the user included the option when * executing the command (use getOption() instead). * - * @param string $name The InputOption name - * * @return bool true if the InputOption object exists, false otherwise */ - public function hasOption($name) + public function hasOption(string $name) { return isset($this->options[$name]); } @@ -294,11 +290,9 @@ public function getOptions() /** * Returns true if an InputOption object exists by shortcut. * - * @param string $name The InputOption shortcut - * * @return bool true if the InputOption object exists, false otherwise */ - public function hasShortcut($name) + public function hasShortcut(string $name) { return isset($this->shortcuts[$name]); } @@ -306,11 +300,9 @@ public function hasShortcut($name) /** * Gets an InputOption by shortcut. * - * @param string $shortcut The Shortcut name - * * @return InputOption An InputOption object */ - public function getOptionForShortcut($shortcut) + public function getOptionForShortcut(string $shortcut) { return $this->getOption($this->shortcutToName($shortcut)); } @@ -333,15 +325,13 @@ public function getOptionDefaults() /** * Returns the InputOption name given a shortcut. * - * @param string $shortcut The shortcut - * * @return string The InputOption name * * @throws InvalidArgumentException When option given does not exist * * @internal */ - public function shortcutToName($shortcut) + public function shortcutToName(string $shortcut) { if (!isset($this->shortcuts[$shortcut])) { throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -353,11 +343,9 @@ public function shortcutToName($shortcut) /** * Gets the synopsis. * - * @param bool $short Whether to return the short version (with options folded) or not - * * @return string The synopsis */ - public function getSynopsis($short = false) + public function getSynopsis(bool $short = false) { $elements = []; diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index b9bcf3bbcd96d..f6ad722a0e350 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -41,7 +41,7 @@ public function getFirstArgument(); * * @return bool true if the value is contained in the raw parameters */ - public function hasParameterOption($values, $onlyParams = false); + public function hasParameterOption($values, bool $onlyParams = false); /** * Returns the value of a raw option (not parsed). @@ -57,7 +57,7 @@ public function hasParameterOption($values, $onlyParams = false); * * @return mixed The option value */ - public function getParameterOption($values, $default = false, $onlyParams = false); + public function getParameterOption($values, $default = false, bool $onlyParams = false); /** * Binds the current Input instance with the given arguments and options. @@ -83,23 +83,20 @@ public function getArguments(); /** * Returns the argument value for a given argument name. * - * @param string $name The argument name - * * @return string|string[]|null The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ - public function getArgument($name); + public function getArgument(string $name); /** * Sets an argument value by name. * - * @param string $name The argument name * @param string|string[]|null $value The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ - public function setArgument($name, $value); + public function setArgument(string $name, $value); /** * Returns true if an InputArgument object exists by name or position. @@ -120,32 +117,27 @@ public function getOptions(); /** * Returns the option value for a given option name. * - * @param string $name The option name - * * @return string|string[]|bool|null The option value * * @throws InvalidArgumentException When option given doesn't exist */ - public function getOption($name); + public function getOption(string $name); /** * Sets an option value by name. * - * @param string $name The option name * @param string|string[]|bool|null $value The option value * * @throws InvalidArgumentException When option given doesn't exist */ - public function setOption($name, $value); + public function setOption(string $name, $value); /** * Returns true if an InputOption object exists by name. * - * @param string $name The InputOption name - * * @return bool true if the InputOption object exists, false otherwise */ - public function hasOption($name); + public function hasOption(string $name); /** * Is this input means interactive? @@ -156,8 +148,6 @@ public function isInteractive(); /** * Sets the input interactivity. - * - * @param bool $interactive If the input should be interactive */ - public function setInteractive($interactive); + public function setInteractive(bool $interactive); } diff --git a/src/Symfony/Component/Console/Input/StringInput.php b/src/Symfony/Component/Console/Input/StringInput.php index 0c63ed0e0e5d1..b80642566e290 100644 --- a/src/Symfony/Component/Console/Input/StringInput.php +++ b/src/Symfony/Component/Console/Input/StringInput.php @@ -40,13 +40,11 @@ public function __construct(string $input) /** * Tokenizes a string. * - * @param string $input The input to tokenize - * * @return array An array of tokens * * @throws InvalidArgumentException When unable to parse input (should never happen) */ - private function tokenize($input) + private function tokenize(string $input) { $tokens = []; $length = \strlen($input); diff --git a/src/Symfony/Component/Console/Output/BufferedOutput.php b/src/Symfony/Component/Console/Output/BufferedOutput.php index 8afc8931ed49c..a5ad7ada50001 100644 --- a/src/Symfony/Component/Console/Output/BufferedOutput.php +++ b/src/Symfony/Component/Console/Output/BufferedOutput.php @@ -34,7 +34,7 @@ public function fetch() /** * {@inheritdoc} */ - protected function doWrite($message, $newline) + protected function doWrite(string $message, bool $newline) { $this->buffer .= $message; diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php index 8430c9c82fd5e..bb08c8958fff1 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php @@ -60,7 +60,7 @@ public function section(): ConsoleSectionOutput /** * {@inheritdoc} */ - public function setDecorated($decorated) + public function setDecorated(bool $decorated) { parent::setDecorated($decorated); $this->stderr->setDecorated($decorated); @@ -78,7 +78,7 @@ public function setFormatter(OutputFormatterInterface $formatter) /** * {@inheritdoc} */ - public function setVerbosity($level) + public function setVerbosity(int $level) { parent::setVerbosity($level); $this->stderr->setVerbosity($level); diff --git a/src/Symfony/Component/Console/Output/NullOutput.php b/src/Symfony/Component/Console/Output/NullOutput.php index 218f285bfe51c..78a1cb4bbf499 100644 --- a/src/Symfony/Component/Console/Output/NullOutput.php +++ b/src/Symfony/Component/Console/Output/NullOutput.php @@ -44,7 +44,7 @@ public function getFormatter() /** * {@inheritdoc} */ - public function setDecorated($decorated) + public function setDecorated(bool $decorated) { // do nothing } @@ -60,7 +60,7 @@ public function isDecorated() /** * {@inheritdoc} */ - public function setVerbosity($level) + public function setVerbosity(int $level) { // do nothing } @@ -108,7 +108,7 @@ public function isDebug() /** * {@inheritdoc} */ - public function writeln($messages, $options = self::OUTPUT_NORMAL) + public function writeln($messages, int $options = self::OUTPUT_NORMAL) { // do nothing } @@ -116,7 +116,7 @@ public function writeln($messages, $options = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL) + public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) { // do nothing } diff --git a/src/Symfony/Component/Console/Output/Output.php b/src/Symfony/Component/Console/Output/Output.php index 9dd765113c026..ed13d58fc0d28 100644 --- a/src/Symfony/Component/Console/Output/Output.php +++ b/src/Symfony/Component/Console/Output/Output.php @@ -63,7 +63,7 @@ public function getFormatter() /** * {@inheritdoc} */ - public function setDecorated($decorated) + public function setDecorated(bool $decorated) { $this->formatter->setDecorated($decorated); } @@ -79,9 +79,9 @@ public function isDecorated() /** * {@inheritdoc} */ - public function setVerbosity($level) + public function setVerbosity(int $level) { - $this->verbosity = (int) $level; + $this->verbosity = $level; } /** @@ -127,7 +127,7 @@ public function isDebug() /** * {@inheritdoc} */ - public function writeln($messages, $options = self::OUTPUT_NORMAL) + public function writeln($messages, int $options = self::OUTPUT_NORMAL) { $this->write($messages, true, $options); } @@ -135,7 +135,7 @@ public function writeln($messages, $options = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL) + public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; @@ -169,9 +169,6 @@ public function write($messages, $newline = false, $options = self::OUTPUT_NORMA /** * Writes a message to the output. - * - * @param string $message A message to write to the output - * @param bool $newline Whether to add a newline or not */ - abstract protected function doWrite($message, $newline); + abstract protected function doWrite(string $message, bool $newline); } diff --git a/src/Symfony/Component/Console/Output/OutputInterface.php b/src/Symfony/Component/Console/Output/OutputInterface.php index 0dfd12b98749c..38f82d869aa25 100644 --- a/src/Symfony/Component/Console/Output/OutputInterface.php +++ b/src/Symfony/Component/Console/Output/OutputInterface.php @@ -37,7 +37,7 @@ interface OutputInterface * @param bool $newline Whether to add a newline * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL */ - public function write($messages, $newline = false, $options = 0); + public function write($messages, bool $newline = false, int $options = 0); /** * Writes a message to the output and adds a newline at the end. @@ -45,14 +45,12 @@ public function write($messages, $newline = false, $options = 0); * @param string|iterable $messages The message as an iterable of strings or a single string * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL */ - public function writeln($messages, $options = 0); + public function writeln($messages, int $options = 0); /** * Sets the verbosity of the output. - * - * @param int $level The level of verbosity (one of the VERBOSITY constants) */ - public function setVerbosity($level); + public function setVerbosity(int $level); /** * Gets the current verbosity of the output. @@ -91,10 +89,8 @@ public function isDebug(); /** * Sets the decorated flag. - * - * @param bool $decorated Whether to decorate the messages */ - public function setDecorated($decorated); + public function setDecorated(bool $decorated); /** * Gets the decorated flag. diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 43f7a2f2340e6..b7caa91382d9e 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -68,7 +68,7 @@ public function getStream() /** * {@inheritdoc} */ - protected function doWrite($message, $newline) + protected function doWrite(string $message, bool $newline) { if ($newline) { $message .= PHP_EOL; diff --git a/src/Symfony/Component/Console/Style/OutputStyle.php b/src/Symfony/Component/Console/Style/OutputStyle.php index b1262b55de4e9..72d6deaca384d 100644 --- a/src/Symfony/Component/Console/Style/OutputStyle.php +++ b/src/Symfony/Component/Console/Style/OutputStyle.php @@ -33,7 +33,7 @@ public function __construct(OutputInterface $output) /** * {@inheritdoc} */ - public function newLine($count = 1) + public function newLine(int $count = 1) { $this->output->write(str_repeat(PHP_EOL, $count)); } @@ -43,7 +43,7 @@ public function newLine($count = 1) * * @return ProgressBar */ - public function createProgressBar($max = 0) + public function createProgressBar(int $max = 0) { return new ProgressBar($this->output, $max); } @@ -51,7 +51,7 @@ public function createProgressBar($max = 0) /** * {@inheritdoc} */ - public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) + public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) { $this->output->write($messages, $newline, $type); } @@ -59,7 +59,7 @@ public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function writeln($messages, $type = self::OUTPUT_NORMAL) + public function writeln($messages, int $type = self::OUTPUT_NORMAL) { $this->output->writeln($messages, $type); } @@ -67,7 +67,7 @@ public function writeln($messages, $type = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function setVerbosity($level) + public function setVerbosity(int $level) { $this->output->setVerbosity($level); } @@ -83,7 +83,7 @@ public function getVerbosity() /** * {@inheritdoc} */ - public function setDecorated($decorated) + public function setDecorated(bool $decorated) { $this->output->setDecorated($decorated); } diff --git a/src/Symfony/Component/Console/Style/StyleInterface.php b/src/Symfony/Component/Console/Style/StyleInterface.php index 475c268ffe403..afb841c0d0890 100644 --- a/src/Symfony/Component/Console/Style/StyleInterface.php +++ b/src/Symfony/Component/Console/Style/StyleInterface.php @@ -20,17 +20,13 @@ interface StyleInterface { /** * Formats a command title. - * - * @param string $message */ - public function title($message); + public function title(string $message); /** * Formats a section title. - * - * @param string $message */ - public function section($message); + public function section(string $message); /** * Formats a list. @@ -87,65 +83,47 @@ public function table(array $headers, array $rows); /** * Asks a question. * - * @param string $question - * @param string|null $default - * @param callable|null $validator - * * @return mixed */ - public function ask($question, $default = null, $validator = null); + public function ask(string $question, ?string $default = null, callable $validator = null); /** * Asks a question with the user input hidden. * - * @param string $question - * @param callable|null $validator - * * @return mixed */ - public function askHidden($question, $validator = null); + public function askHidden(string $question, callable $validator = null); /** * Asks for confirmation. * - * @param string $question - * @param bool $default - * * @return bool */ - public function confirm($question, $default = true); + public function confirm(string $question, bool $default = true); /** * Asks a choice question. * - * @param string $question - * @param array $choices * @param string|int|null $default * * @return mixed */ - public function choice($question, array $choices, $default = null); + public function choice(string $question, array $choices, $default = null); /** * Add newline(s). - * - * @param int $count The number of newlines */ - public function newLine($count = 1); + public function newLine(int $count = 1); /** * Starts the progress output. - * - * @param int $max Maximum steps (0 if unknown) */ - public function progressStart($max = 0); + public function progressStart(int $max = 0); /** * Advances the progress output X steps. - * - * @param int $step Number of steps to advance */ - public function progressAdvance($step = 1); + public function progressAdvance(int $step = 1); /** * Finishes the progress output. diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 962ba923f3de4..598f7cbe23177 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -55,13 +55,8 @@ public function __construct(InputInterface $input, OutputInterface $output) * Formats a message as a block of text. * * @param string|array $messages The message to write in the block - * @param string|null $type The block type (added in [] on first line) - * @param string|null $style The style to apply to the whole block - * @param string $prefix The prefix for the block - * @param bool $padding Whether to add vertical padding - * @param bool $escape Whether to escape the message */ - public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true) + public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) { $messages = \is_array($messages) ? array_values($messages) : [$messages]; @@ -73,7 +68,7 @@ public function block($messages, $type = null, $style = null, $prefix = ' ', $pa /** * {@inheritdoc} */ - public function title($message) + public function title(string $message) { $this->autoPrependBlock(); $this->writeln([ @@ -86,7 +81,7 @@ public function title($message) /** * {@inheritdoc} */ - public function section($message) + public function section(string $message) { $this->autoPrependBlock(); $this->writeln([ @@ -193,7 +188,7 @@ public function table(array $headers, array $rows) /** * {@inheritdoc} */ - public function ask($question, $default = null, $validator = null) + public function ask(string $question, ?string $default = null, $validator = null) { $question = new Question($question, $default); $question->setValidator($validator); @@ -204,7 +199,7 @@ public function ask($question, $default = null, $validator = null) /** * {@inheritdoc} */ - public function askHidden($question, $validator = null) + public function askHidden(string $question, $validator = null) { $question = new Question($question); @@ -225,7 +220,7 @@ public function confirm($question, $default = true) /** * {@inheritdoc} */ - public function choice($question, array $choices, $default = null) + public function choice(string $question, array $choices, $default = null) { if (null !== $default) { $values = array_flip($choices); @@ -238,7 +233,7 @@ public function choice($question, array $choices, $default = null) /** * {@inheritdoc} */ - public function progressStart($max = 0) + public function progressStart(int $max = 0) { $this->progressBar = $this->createProgressBar($max); $this->progressBar->start(); @@ -247,7 +242,7 @@ public function progressStart($max = 0) /** * {@inheritdoc} */ - public function progressAdvance($step = 1) + public function progressAdvance(int $step = 1) { $this->getProgressBar()->advance($step); } @@ -265,7 +260,7 @@ public function progressFinish() /** * {@inheritdoc} */ - public function createProgressBar($max = 0) + public function createProgressBar(int $max = 0) { $progressBar = parent::createProgressBar($max); @@ -304,7 +299,7 @@ public function askQuestion(Question $question) /** * {@inheritdoc} */ - public function writeln($messages, $type = self::OUTPUT_NORMAL) + public function writeln($messages, int $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; @@ -319,7 +314,7 @@ public function writeln($messages, $type = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) + public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; @@ -334,7 +329,7 @@ public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) /** * {@inheritdoc} */ - public function newLine($count = 1) + public function newLine(int $count = 1) { parent::newLine($count); $this->bufferedOutput->write(str_repeat("\n", $count)); diff --git a/src/Symfony/Component/Console/Tester/ApplicationTester.php b/src/Symfony/Component/Console/Tester/ApplicationTester.php index ced56cff208bb..9da40cf375c4c 100644 --- a/src/Symfony/Component/Console/Tester/ApplicationTester.php +++ b/src/Symfony/Component/Console/Tester/ApplicationTester.php @@ -47,12 +47,9 @@ public function __construct(Application $application) * * verbosity: Sets the output verbosity flag * * capture_stderr_separately: Make output of stdOut and stdErr separately available * - * @param array $input An array of arguments and options - * @param array $options An array of options - * * @return int The command exit code */ - public function run(array $input, $options = []) + public function run(array $input, array $options = []) { $this->input = new ArrayInput($input); if (isset($options['interactive'])) { diff --git a/src/Symfony/Component/Console/Tester/TesterTrait.php b/src/Symfony/Component/Console/Tester/TesterTrait.php index 5b7e993a83c63..8c5ab7fe71139 100644 --- a/src/Symfony/Component/Console/Tester/TesterTrait.php +++ b/src/Symfony/Component/Console/Tester/TesterTrait.php @@ -29,11 +29,9 @@ trait TesterTrait /** * Gets the display returned by the last execution of the command or application. * - * @param bool $normalize Whether to normalize end of lines to \n or not - * * @return string The display */ - public function getDisplay($normalize = false) + public function getDisplay(bool $normalize = false) { if (null === $this->output) { throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?'); @@ -57,7 +55,7 @@ public function getDisplay($normalize = false) * * @return string */ - public function getErrorOutput($normalize = false) + public function getErrorOutput(bool $normalize = false) { if (!$this->captureStreamsIndependently) { throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.'); diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index be73e5c941663..937487a3c86cf 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -185,13 +185,6 @@ public function testGetSetAliases() $this->assertEquals(['name1'], $command->getAliases(), '->setAliases() sets the aliases'); } - public function testSetAliasesNull() - { - $command = new \TestCommand(); - $this->expectException('InvalidArgumentException'); - $command->setAliases(null); - } - public function testGetSynopsis() { $command = new \TestCommand(); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php index 13e918b3a0fe2..58b16170a4265 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableStyleTest.php @@ -23,6 +23,6 @@ class TableStyleTest extends TestCase public function testSetPadTypeWithInvalidType() { $style = new TableStyle(); - $style->setPadType('TEST'); + $style->setPadType(31); } } diff --git a/src/Symfony/Component/Console/Tests/Output/OutputTest.php b/src/Symfony/Component/Console/Tests/Output/OutputTest.php index 7cfa6cdc0aab6..330064973baa0 100644 --- a/src/Symfony/Component/Console/Tests/Output/OutputTest.php +++ b/src/Symfony/Component/Console/Tests/Output/OutputTest.php @@ -182,7 +182,7 @@ public function clear() $this->output = ''; } - protected function doWrite($message, $newline) + protected function doWrite(string $message, bool $newline) { $this->output .= $message.($newline ? "\n" : ''); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy