X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FAnnotatedCommand.php;fp=vendor%2Fconsolidation%2Fannotated-command%2Fsrc%2FAnnotatedCommand.php;h=41be53a96aca8f5f2ed29edaeef29dc2b42b92d6;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=597d6a2fa97858e05dca42b66fdf77463070e8f5;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/consolidation/annotated-command/src/AnnotatedCommand.php b/vendor/consolidation/annotated-command/src/AnnotatedCommand.php index 597d6a2fa..41be53a96 100644 --- a/vendor/consolidation/annotated-command/src/AnnotatedCommand.php +++ b/vendor/consolidation/annotated-command/src/AnnotatedCommand.php @@ -3,8 +3,6 @@ namespace Consolidation\AnnotatedCommand; use Consolidation\AnnotatedCommand\Hooks\HookManager; use Consolidation\AnnotatedCommand\Parser\CommandInfo; -use Consolidation\OutputFormatters\FormatterManager; -use Consolidation\OutputFormatters\Options\FormatterOptions; use Consolidation\AnnotatedCommand\Help\HelpDocumentAlter; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -132,6 +130,11 @@ class AnnotatedCommand extends Command implements HelpDocumentAlter } $this->setCommandArguments($commandInfo); $this->setReturnType($commandInfo->getReturnType()); + // Hidden commands available since Symfony 3.2 + // http://symfony.com/doc/current/console/hide_commands.html + if (method_exists($this, 'setHidden')) { + $this->setHidden($commandInfo->getHidden()); + } return $this; } @@ -225,8 +228,11 @@ class AnnotatedCommand extends Command implements HelpDocumentAlter */ protected function checkUsesInputInterface($params) { + /** @var \ReflectionParameter $firstParam */ $firstParam = reset($params); - return $firstParam instanceof InputInterface; + return $firstParam && $firstParam->getClass() && $firstParam->getClass()->implementsInterface( + '\\Symfony\\Component\\Console\\Input\\InputInterface' + ); } /** @@ -251,7 +257,11 @@ class AnnotatedCommand extends Command implements HelpDocumentAlter $index = $this->checkUsesInputInterface($params) ? 1 : 0; $this->usesOutputInterface = (count($params) > $index) && - ($params[$index] instanceof OutputInterface); + $params[$index]->getClass() && + $params[$index]->getClass()->implementsInterface( + '\\Symfony\\Component\\Console\\Output\\OutputInterface' + ) + ; return $this; } @@ -428,10 +438,15 @@ class AnnotatedCommand extends Command implements HelpDocumentAlter ); $commandData->setUseIOInterfaces( - $this->usesOutputInterface, - $this->usesInputInterface + $this->usesInputInterface, + $this->usesOutputInterface ); + // Allow the commandData to cache the list of options with + // special default values ('null' and 'true'), as these will + // need special handling. @see CommandData::options(). + $commandData->cacheSpecialDefaults($this->getDefinition()); + return $commandData; } }