[Console] fix return type declarations
This commit is contained in:
parent
523e9b9feb
commit
a32a713045
@ -21,7 +21,6 @@ use Symfony\Component\Console\Event\ConsoleExceptionEvent;
|
|||||||
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
||||||
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Console\Exception\LogicException;
|
|
||||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||||
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
||||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||||
@ -457,13 +456,8 @@ class Application
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $command->getDefinition()) {
|
// Will throw if the command is not correctly initialized.
|
||||||
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
|
$command->getDefinition();
|
||||||
}
|
|
||||||
|
|
||||||
if (!$command->getName()) {
|
|
||||||
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($command)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->commands[$command->getName()] = $command;
|
$this->commands[$command->getName()] = $command;
|
||||||
|
|
||||||
@ -1023,7 +1017,7 @@ class Application
|
|||||||
/**
|
/**
|
||||||
* Gets the name of the command based on input.
|
* Gets the name of the command based on input.
|
||||||
*
|
*
|
||||||
* @return string The command name
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
protected function getCommandName(InputInterface $input)
|
protected function getCommandName(InputInterface $input)
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ class Command
|
|||||||
private $aliases = [];
|
private $aliases = [];
|
||||||
private $definition;
|
private $definition;
|
||||||
private $hidden = false;
|
private $hidden = false;
|
||||||
private $help;
|
private $help = '';
|
||||||
private $description;
|
private $description = '';
|
||||||
private $ignoreValidationErrors = false;
|
private $ignoreValidationErrors = false;
|
||||||
private $applicationDefinitionMerged = false;
|
private $applicationDefinitionMerged = false;
|
||||||
private $applicationDefinitionMergedWithArgs = false;
|
private $applicationDefinitionMergedWithArgs = false;
|
||||||
@ -105,7 +105,7 @@ class Command
|
|||||||
/**
|
/**
|
||||||
* Gets the helper set.
|
* Gets the helper set.
|
||||||
*
|
*
|
||||||
* @return HelperSet A HelperSet instance
|
* @return HelperSet|null A HelperSet instance
|
||||||
*/
|
*/
|
||||||
public function getHelperSet()
|
public function getHelperSet()
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ class Command
|
|||||||
/**
|
/**
|
||||||
* Gets the application instance for this command.
|
* Gets the application instance for this command.
|
||||||
*
|
*
|
||||||
* @return Application An Application instance
|
* @return Application|null An Application instance
|
||||||
*/
|
*/
|
||||||
public function getApplication()
|
public function getApplication()
|
||||||
{
|
{
|
||||||
@ -347,6 +347,10 @@ class Command
|
|||||||
*/
|
*/
|
||||||
public function getDefinition()
|
public function getDefinition()
|
||||||
{
|
{
|
||||||
|
if (null === $this->definition) {
|
||||||
|
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($this)));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->definition;
|
return $this->definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,6 +457,10 @@ class Command
|
|||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
|
if (!$this->name) {
|
||||||
|
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class Question
|
|||||||
*
|
*
|
||||||
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
||||||
*
|
*
|
||||||
* @return callable
|
* @return callable|null
|
||||||
*/
|
*/
|
||||||
public function getNormalizer()
|
public function getNormalizer()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user