Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/console/Command/Command.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 7a779792577d |
children | c2387f117808 |
line wrap: on
line diff
--- a/vendor/symfony/console/Command/Command.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/console/Command/Command.php Mon Apr 23 09:46:53 2018 +0100 @@ -29,6 +29,11 @@ */ class Command { + /** + * @var string|null The default command name + */ + protected static $defaultName; + private $application; private $name; private $processTitle; @@ -46,8 +51,17 @@ private $helperSet; /** - * Constructor. - * + * @return string|null The default command name or null when no default name is set + */ + public static function getDefaultName() + { + $class = get_called_class(); + $r = new \ReflectionProperty($class, 'defaultName'); + + return $class === $r->class ? static::$defaultName : null; + } + + /** * @param string|null $name The name of the command; passing null means it must be set in configure() * * @throws LogicException When the command name is empty @@ -56,15 +70,11 @@ { $this->definition = new InputDefinition(); - if (null !== $name) { + if (null !== $name || null !== $name = static::getDefaultName()) { $this->setName($name); } $this->configure(); - - if (!$this->name) { - throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this))); - } } /** @@ -77,11 +87,6 @@ $this->ignoreValidationErrors = true; } - /** - * Sets the application instance for this command. - * - * @param Application $application An Application instance - */ public function setApplication(Application $application = null) { $this->application = $application; @@ -92,11 +97,6 @@ } } - /** - * Sets the helper set. - * - * @param HelperSet $helperSet A HelperSet instance - */ public function setHelperSet(HelperSet $helperSet) { $this->helperSet = $helperSet; @@ -150,9 +150,6 @@ * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * * @return null|int null or 0 if everything went fine, or an error code * * @throws LogicException When this abstract method is not implemented @@ -170,9 +167,6 @@ * This method is executed before the InputDefinition is validated. * This means that this is the only place where the command can * interactively ask for values of missing required arguments. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance */ protected function interact(InputInterface $input, OutputInterface $output) { @@ -183,9 +177,6 @@ * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -198,9 +189,6 @@ * setCode() method or by overriding the execute() method * in a sub-class. * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * * @return int The command exit code * * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. @@ -475,7 +463,7 @@ } /** - * @return bool Whether the command should be publicly shown or not. + * @return bool whether the command should be publicly shown or not */ public function isHidden() {