diff --git a/examples/Command/CorCommand.php b/examples/Command/CorCommand.php index 166817b..2a37792 100644 --- a/examples/Command/CorCommand.php +++ b/examples/Command/CorCommand.php @@ -38,7 +38,7 @@ public static function aliases(): array * @param Input $input * @param Output $output */ - protected function execute($input, $output) + protected function execute(Input $input, Output $output) { $output->aList([ 'support coroutine?' => Helper::isSupportCoroutine() ? 'Y' : 'N', diff --git a/examples/Controller/HomeController.php b/examples/Controller/HomeController.php index 4770411..494dd7c 100644 --- a/examples/Controller/HomeController.php +++ b/examples/Controller/HomeController.php @@ -11,7 +11,8 @@ use LogicException; use RuntimeException; use Toolkit\Cli\Cli; -use Toolkit\Cli\Download; +use Toolkit\Cli\Util\Download; +use Toolkit\PFlag\FlagsParser; use Toolkit\Stdlib\Php; use function sleep; use function trigger_error; @@ -114,7 +115,7 @@ public function disabledCommand(): void */ protected function defArgConfigure(): void { - $fs = $this->newActionFlags(); + $fs = $this->curActionFlags(); $fs->addOptByRule('yes,y', "bool;description for the option 'yes'"); $fs->addOptByRule('opt1', "bool;description for the option 'opt1'"); @@ -311,29 +312,29 @@ public function dynamicTextCommand(): void * a progress bar example show, by Show::progressBar() * * @options - * --type the progress type, allow: bar,txt. txt - * --done-char the done show char. = - * --wait-char the waiting show char. - - * --sign-char the sign char show. > + * --type the progress type, allow: bar,txt. txt + * --done-char the done show char. = + * --wait-char the waiting show char. - + * --sign-char the sign char show. > * - * @param Input $input + * @param FlagsParser $fs * * @return int * @example * {script} {command} * {script} {command} --done-char '#' --wait-char ' ' */ - public function progressCommand($input): int + public function progressCommand(FlagsParser $fs): int { $i = 0; $total = 120; - if ($input->getOpt('type') === 'bar') { + if ($fs->getOpt('type') === 'bar') { $bar = $this->output->progressBar($total, [ 'msg' => 'Msg Text', 'doneMsg' => 'Done Msg Text', - 'doneChar' => $input->getOpt('done-char', '='), // ▓ - 'waitChar' => $input->getOpt('wait-char', '-'), // ░ - 'signChar' => $input->getOpt('sign-char', '>'), + 'doneChar' => $fs->getOpt('done-char', '='), // ▓ + 'waitChar' => $fs->getOpt('wait-char', '-'), // ░ + 'signChar' => $fs->getOpt('sign-char', '>'), ]); } else { $bar = $this->output->progressTxt($total, 'Doing go g...', 'Done'); @@ -496,6 +497,7 @@ public function paddingCommand(): void * a example for use arguments on command * * @usage home:useArg [arg1=val1 arg2=arg2] [options] + * * @example * home:useArg status=2 name=john arg0 -s=test --page=23 -d -rf --debug --test=false -a v1 --ab -c -g --cd val -h '' -i stat=online * home:useArg status=2 name=john name=tom name=jack arg0 -s=test --page=23 --id=23 --id=154 --id=456 -d -rf --debug --test=false @@ -533,20 +535,28 @@ public function envCommand(): void /** * This is a demo for download a file to local - * @usage {command} url=url saveTo=[saveAs] type=[bar|text] + * + * @usage {command} url=url saveTo=[saveAs] --type=[bar|text] + * + * @options + * --type The progress bar type. allow: bar, text(default) + * + * @arguments + * url string;The remote file url;required + * saveAs The local file path for save download file. * * @example {command} url=https://github.com/inhere/php-console/archive/master.zip type=bar */ - public function downCommand(): int + public function downCommand(FlagsParser $fs): int { - $url = $this->input->getArg('url'); - + $url = $fs->getArg('url'); if (!$url) { - $this->output->liteError('Please input you want to downloaded file url, use: url=[url]', 1); + $this->output->liteError('Please input the downloaded file url'); + return 1; } - $saveAs = $this->input->getArg('saveAs'); - $type = $this->input->getArg('type', 'text'); + $saveAs = $fs->getArg('saveAs'); + $type = $fs->getOpt('type', 'text'); if (!$saveAs) { $saveAs = __DIR__ . '/' . basename($url); diff --git a/examples/Controller/ShowController.php b/examples/Controller/ShowController.php index 1730bd8..dad3461 100644 --- a/examples/Controller/ShowController.php +++ b/examples/Controller/ShowController.php @@ -18,6 +18,7 @@ use ReflectionException; use Toolkit\Cli\Color; use Toolkit\Cli\Highlighter; +use Toolkit\PFlag\FlagsParser; use function file_get_contents; /** @@ -61,14 +62,17 @@ public function titleCommand(): int /** * output format message: splitLine + * * @options - * -w, --width WIDTH The split line width. default is current screen width. + * -w, --width int;The split line width. default is current screen width. */ - public function splitLineCommand(): int + public function splitLineCommand(FlagsParser $fs): int { - $this->output->splitLine('', '=', $this->getSameOpt(['w', 'width'], 0)); - $this->output->splitLine('split Line', '-', $this->getSameOpt(['w', 'width'], 0)); - $this->output->splitLine('split 中文 Line', '-', $this->getSameOpt(['w', 'width'], 0)); + $width = $fs->getOpt('width'); + + $this->output->splitLine('', '=', $width); + $this->output->splitLine('split Line', '-', $width); + $this->output->splitLine('split 中文 Line', '-', $width); return 0; } diff --git a/src/BuiltIn/SelfUpdateCommand.php b/src/BuiltIn/SelfUpdateCommand.php index 5191186..2dc7d9a 100644 --- a/src/BuiltIn/SelfUpdateCommand.php +++ b/src/BuiltIn/SelfUpdateCommand.php @@ -49,7 +49,7 @@ class SelfUpdateCommand extends Command * @param Input $input * @param Output $output */ - protected function execute($input, $output) + protected function execute(Input $input, Output $output) { $this->version = $this->getApp()->getVersion(); $parser = new VersionParser; diff --git a/src/Command.php b/src/Command.php index f6d86f5..6ce2001 100644 --- a/src/Command.php +++ b/src/Command.php @@ -9,8 +9,9 @@ namespace Inhere\Console; use Inhere\Console\Contract\CommandInterface; -use Inhere\Console\IO\Input; +use Inhere\Console\Handler\AbstractHandler; use ReflectionException; +use Toolkit\PFlag\FlagsParser; /** * Class Command @@ -20,7 +21,7 @@ * ```php * class MyCommand extends Command * { - * protected function execute($input, $output) + * protected function execute(Input $input, Output $output) * { * // some logic ... * } @@ -49,44 +50,39 @@ protected function init(): void } /** - * @throws ReflectionException + * @param FlagsParser $fs */ - protected function initForRun(Input $input): void + protected function beforeInitFlagsParser(FlagsParser $fs): void { - parent::initForRun($input); + $fs->setStopOnFistArg(false); - $this->flags->setStopOnFistArg(false); // old mode: options and arguments at method annotations if ($this->compatible) { - $this->flags->setSkipOnUndefined(true); + $fs->setSkipOnUndefined(true); } + } - $this->debugf('load flags configure for command: %s', self::getName()); - // load input definition configure + /** + * @param FlagsParser $fs + * + * @throws ReflectionException + */ + protected function afterInitFlagsParser(FlagsParser $fs): void + { + $this->debugf('load flags configure for command: %s', $this->getRealName()); $this->configure(); + $isEmpty = $this->flags->isEmpty(); + + // load built in options + $fs->addOptsByRules(GlobalOption::getAloneOptions()); + // not config flags. load rules from method doc-comments - if ($this->flags->isEmpty()) { - $this->loadRulesByDocblock(self::METHOD, $this->flags); + if ($isEmpty) { + $this->loadRulesByDocblock(self::METHOD, $fs); } } - // protected function doRun(array $args) - // { - // parent::doRun($args); - // } - - /* - * Configure command - */ - // protected function configure() - // { - // $this - // ->createDefinition() - // ->addArgument('test') - // ->addOption('test'); - // } - /** * @param Command $parent */ @@ -98,10 +94,10 @@ public function setParent(Command $parent): void /** * @return $this */ - public function getRootCommand(): Command + public function getRoot(): Command { if ($this->parent) { - return $this->parent->getRootCommand(); + return $this->parent->getRoot(); } return $this; diff --git a/src/Component/ConsoleAppIShell.php b/src/Component/ConsoleAppIShell.php index 49bb0c9..01457f0 100644 --- a/src/Component/ConsoleAppIShell.php +++ b/src/Component/ConsoleAppIShell.php @@ -3,14 +3,14 @@ namespace Inhere\Console\Component; use Inhere\Console\Application; -use Toolkit\Stdlib\Obj\AbstractObj; +use Inhere\Console\Component\Interact\IShell; /** * Class ConsoleAppIShell * * @package Inhere\Console */ -class ConsoleAppIShell extends AbstractObj +class ConsoleAppIShell extends IShell { /** * @var Application diff --git a/src/Concern/ApplicationHelpTrait.php b/src/Concern/ApplicationHelpTrait.php index 7ccdb25..a65caf4 100644 --- a/src/Concern/ApplicationHelpTrait.php +++ b/src/Concern/ApplicationHelpTrait.php @@ -8,7 +8,7 @@ namespace Inhere\Console\Concern; -use Inhere\Console\AbstractHandler; +use Inhere\Console\Handler\AbstractHandler; use Inhere\Console\Console; use Inhere\Console\ConsoleEvent; use Inhere\Console\Contract\CommandInterface; diff --git a/src/Concern/CommandHelpTrait.php b/src/Concern/CommandHelpTrait.php index d34ea5b..564016c 100644 --- a/src/Concern/CommandHelpTrait.php +++ b/src/Concern/CommandHelpTrait.php @@ -2,7 +2,7 @@ namespace Inhere\Console\Concern; -use Inhere\Console\AbstractHandler; +use Inhere\Console\Handler\AbstractHandler; use Inhere\Console\Annotate\DocblockRules; use Inhere\Console\Console; use Inhere\Console\Util\FormatUtil; diff --git a/src/Concern/ControllerHelpTrait.php b/src/Concern/ControllerHelpTrait.php index c8f2204..5e305f9 100644 --- a/src/Concern/ControllerHelpTrait.php +++ b/src/Concern/ControllerHelpTrait.php @@ -3,6 +3,7 @@ namespace Inhere\Console\Concern; use Inhere\Console\Console; +use Inhere\Console\GlobalOption; use Inhere\Console\Util\FormatUtil; use ReflectionClass; use Toolkit\Cli\ColorTag; @@ -32,7 +33,6 @@ trait ControllerHelpTrait * -s, --search Search command by input keywords * --format Set the help information dump format(raw, xml, json, markdown) * @return int - * @throws \ReflectionException * @example * {script} {name} -h * {script} {name}:help @@ -96,7 +96,7 @@ public function showCommandList(): void } $commands = []; - $showDisabled = (bool)$this->getOpt('show-disabled', false); + $showDisabled = $this->flags->getOpt(GlobalOption::SHOW_DISABLED, false); $defaultDes = 'No description message'; /** @@ -144,7 +144,7 @@ public function showCommandList(): void // if is alone running. if ($detached = $this->isDetached()) { - $name = $sName . ' '; + // $name = $sName . ' '; $usage = "$script COMMAND [--options ...] [arguments ...]"; } else { $name = $sName . $this->delimiter; diff --git a/src/Concern/InputFlagsWareTrait.php b/src/Concern/InputFlagsWareTrait.php deleted file mode 100644 index e9709a6..0000000 --- a/src/Concern/InputFlagsWareTrait.php +++ /dev/null @@ -1,13 +0,0 @@ -input->getScriptName(); } - /** - * @param int|string $name - * @param mixed $default - * - * @return mixed|null - * @see Input::getArg() - */ - public function getArg($name, $default = null) - { - return $this->input->getArg($name, $default); - } - - /** - * @param string $default - * - * @return string - * @see Input::getFirstArg() - */ - public function getFirstArg(string $default = ''): string - { - return $this->input->getFirstArg($default); - } - - /** - * @param int|string $name - * - * @return mixed - * @see Input::getRequiredArg() - */ - public function getRequiredArg($name) - { - return $this->input->getRequiredArg($name); - } - - /** - * @param string|array $names - * @param mixed $default - * - * @return bool|mixed|null - * @see Input::getSameArg() - */ - public function getSameArg($names, $default = null) - { - return $this->input->getSameArg($names, $default); - } - - /** - * @param int|string $name - * @param mixed $default - * - * @return mixed - */ - public function getOpt($name, $default = null) - { - return $this->input->getOpt($name, $default); - } - - /** - * @param string|string[] $names eg 'n,name' OR ['n', 'name'] - * @param mixed $default - * - * @return mixed - */ - public function getSameOpt($names, $default = null) - { - return $this->input->getSameOpt($names, $default); - } - - /** - * @param string $name - * @param string $errMsg - * - * @return mixed - */ - public function getRequiredOpt(string $name, string $errMsg = '') - { - return $this->input->getRequiredOpt($name, $errMsg); - } - /** * @param string $question * @param bool $nl diff --git a/src/Contract/CommandHandlerInterface.php b/src/Contract/CommandHandlerInterface.php index 96740a7..3b053c4 100644 --- a/src/Contract/CommandHandlerInterface.php +++ b/src/Contract/CommandHandlerInterface.php @@ -9,7 +9,6 @@ namespace Inhere\Console\Contract; use Inhere\Console\AbstractApplication; -use Inhere\Console\IO\InputDefinition; /** * Interface CommandHandlerInterface @@ -50,6 +49,8 @@ public function getApp(): AbstractApplication; public function getGroupName(): string; /** + * Alias of the getName() + * * @return string */ public function getRealName(): string; diff --git a/src/Controller.php b/src/Controller.php index 418bd76..c611538 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -12,6 +12,7 @@ use Inhere\Console\Concern\ControllerHelpTrait; use Inhere\Console\Contract\ControllerInterface; use Inhere\Console\Exception\ConsoleException; +use Inhere\Console\Handler\AbstractHandler; use Inhere\Console\IO\Input; use Inhere\Console\IO\Output; use Inhere\Console\Util\FormatUtil; @@ -38,7 +39,6 @@ use function substr; use function trim; use function ucfirst; -use function vdump; /** * Class Controller @@ -213,9 +213,36 @@ protected function onNotFound(string $action, array $args): bool return false; } - protected function getBuiltInOptions(): array + /** + * @param FlagsParser $fs + */ + protected function afterInitFlagsParser(FlagsParser $fs): void { - return GlobalOption::getGroupOptions(); + $fs->addOptsByRules(GlobalOption::getGroupOptions()); + } + + /** + * Run an action with args + * + * Usage: + * + * ```php + * $args = $this->flags->getRawArgs(); + * // add option + * $args[] = '--push'; + * $this->runActionWithArgs('subcmd', $args); + * ``` + * + * @param string $cmd + * @param array $args + * + * @return bool|int|mixed + * @throws Throwable + */ + public function runActionWithArgs(string $cmd, array $args) + { + $args[0] = $cmd; + return $this->doRun($args); } protected function beforeRun(): void @@ -345,7 +372,7 @@ protected function afterAction(): void * @return mixed * @throws ReflectionException */ - final public function execute($input, $output) + final public function execute(Input $input, Output $output) { $action = $this->action; $group = static::getName(); @@ -447,7 +474,7 @@ protected function newActionFlags(string $action = ''): FlagsParser $action = $action ?: $this->action; if (!$fs = $this->getActionFlags($action)) { $fs = new SFlags(['name' => $action]); - // $fs->setStopOnFistArg(false); + $fs->setStopOnFistArg(false); $fs->setBeforePrintHelp(function (string $text) { return $this->parseCommentsVars($text); }); @@ -480,23 +507,10 @@ protected function getMethodName(string $action): string /** * @return bool + * @throws ReflectionException */ protected function showHelp(): bool { - // render help by Definition - // if ($definition = $this->getDefinition()) { - // if ($action = $this->action) { - // $aliases = $this->getCommandAliases($action); - // } else { - // $aliases = $this->getAliases(); - // } - // - // $this->showHelpByDefinition($definition, $aliases); - // return true; - // } - - // TODO show help by flags - return $this->helpCommand() === 0; } diff --git a/src/GlobalOption.php b/src/GlobalOption.php index accb116..98ad71f 100644 --- a/src/GlobalOption.php +++ b/src/GlobalOption.php @@ -26,10 +26,6 @@ class GlobalOption public const NO_INTERACTIVE = 'no-interactive'; - public const HELP_OPTS = ['h', 'help']; - - public const VERSION_OPTS = ['V', 'version']; - public const KEY_MAP = [ 'debug' => 1, 'ishell' => 1, @@ -47,25 +43,17 @@ class GlobalOption * @psalm-var array */ private static $options = [ - // '--debug' => 'int;Setting the runtime log debug level(quiet 0 - 5 crazy);no;1', '--debug' => [ 'type' => FlagType::INT, 'desc' => 'Setting the runtime log debug level(quiet 0 - 5 crazy)', 'envVar' => Console::DEBUG_ENV_KEY, ], - // '--debug' => 'Setting the runtime log debug level(quiet 0 - 5 crazy)', '--ishell' => 'bool;Run application an interactive shell environment', - // '--ishell' => 'Run application an interactive shell environment', '--profile' => 'bool;Display timing and memory usage information', - // '--profile' => 'Display timing and memory usage information', '--no-color' => 'bool;Disable color/ANSI for message output', - // '--no-color' => 'Disable color/ANSI for message output', '--help' => 'bool;Display this help message;;;h', - // '-h, --help' => 'Display this help message', '--version' => 'bool;Show application version information;;;V', - // '-V, --version' => 'Show application version information', '--no-interactive' => 'bool;Run commands in a non-interactive environment', - // '--no-interactive' => 'Run commands in a non-interactive environment', ]; /** @@ -76,19 +64,21 @@ class GlobalOption // '--show-disabled' => 'string;Whether display disabled commands', ]; + public const SHOW_DISABLED = 'show-disabled'; + /** * @var array built-in options for the group command */ protected static $groupOptions = [ // '--help' => 'bool;Display this help message;;;h', - '--show-disabled' => 'string;Whether display disabled commands', + self::SHOW_DISABLED => 'string;Whether display disabled commands', ]; /** * @var array common options for the group/command */ protected static $commonOptions = [ - '--help' => 'bool;Display this help message;;;h', + self::HELP => 'bool;Display this help message;;;h', ]; /** diff --git a/src/AbstractHandler.php b/src/Handler/AbstractHandler.php similarity index 92% rename from src/AbstractHandler.php rename to src/Handler/AbstractHandler.php index d3d476f..4187e0c 100644 --- a/src/AbstractHandler.php +++ b/src/Handler/AbstractHandler.php @@ -6,7 +6,7 @@ * Time: 11:40 */ -namespace Inhere\Console; +namespace Inhere\Console\Handler; use Inhere\Console\Annotate\DocblockRules; use Inhere\Console\Component\ErrorHandler; @@ -15,6 +15,8 @@ use Inhere\Console\Concern\InputOutputAwareTrait; use Inhere\Console\Concern\SubCommandsWareTrait; use Inhere\Console\Concern\UserInteractAwareTrait; +use Inhere\Console\Console; +use Inhere\Console\ConsoleEvent; use Inhere\Console\Contract\CommandHandlerInterface; use Inhere\Console\Contract\CommandInterface; use Inhere\Console\IO\Input; @@ -24,14 +26,11 @@ use InvalidArgumentException; use ReflectionException; use RuntimeException; -use Swoole\Coroutine; -use Swoole\Event; use Throwable; use Toolkit\PFlag\FlagsParser; use Toolkit\PFlag\SFlags; use Toolkit\Stdlib\Helper\PhpHelper; use Toolkit\Stdlib\Obj\ConfigObject; -use function array_merge; use function cli_set_process_title; use function error_get_last; use function function_exists; @@ -241,20 +240,22 @@ protected function annotationVars(): array * running a command **************************************************************************/ - protected function initForRun(Input $input): void + /** + * @param Input $input + */ + protected function initFlagsParser(Input $input): void { $input->setFs($this->flags); $this->flags->setDesc(self::getDesc()); $this->flags->setScriptName(self::getName()); - // load built in options - // $builtInOpts = GlobalOption::getAloneOptions(); - $builtInOpts = $this->getBuiltInOptions(); - $this->flags->addOptsByRules($builtInOpts); + $this->beforeInitFlagsParser($this->flags); // set options by options() $optRules = $this->options(); $this->flags->addOptsByRules($optRules); + + // for render help $this->flags->setBeforePrintHelp(function (string $text) { return $this->parseCommentsVars($text); }); @@ -262,11 +263,24 @@ protected function initForRun(Input $input): void $this->logf(Console::VERB_DEBUG, 'show help message by input flags: -h, --help'); $this->showHelp(); }); + + $this->afterInitFlagsParser($this->flags); } - protected function getBuiltInOptions(): array + /** + * @param FlagsParser $fs + */ + protected function beforeInitFlagsParser(FlagsParser $fs): void { - return GlobalOption::getAloneOptions(); + // $fs->addOptsByRules(GlobalOption::getAloneOptions()); + } + + /** + * @param FlagsParser $fs + */ + protected function afterInitFlagsParser(FlagsParser $fs): void + { + // $fs->addOptsByRules(GlobalOption::getAloneOptions()); } /** @@ -280,7 +294,7 @@ public function run(array $args) $name = self::getName(); try { - $this->initForRun($this->input); + $this->initFlagsParser($this->input); $this->log(Console::VERB_DEBUG, "begin run '$name' - parse options", ['args' => $args]); @@ -318,14 +332,10 @@ protected function doRun(array $args) $rName = $this->resolveAlias($first); if ($this->isSubCommand($rName)) { - + // TODO } } - // $this->debugf('begin run command. load configure for command'); - // // load input definition configure - // $this->configure(); - // some prepare check // - validate input arguments if (true !== $this->prepare()) { @@ -352,34 +362,27 @@ protected function doRun(array $args) } $this->afterExecute(); - return $result; } /** * coroutine run by swoole go() * - * @return bool + * @return int */ - public function coExecute(): bool + public function coExecute(): int { - // $ch = new Coroutine\Channel(1); - $ok = Coroutine::create(function () { + $cid = \Swoole\Coroutine\run(function () { $this->execute($this->input, $this->output); - // $ch->push($result); }); // if create co fail - if ((int)$ok === 0) { - // if open debug, output a tips + if ($cid < 0) { $this->logf(Console::VERB_DEBUG, 'ERROR: The coroutine create failed'); - // exec by normal flow - $result = $this->execute($this->input, $this->output); + $result = (int)$this->execute($this->input, $this->output); } else { // success: wait coroutine exec. - Event::wait(); $result = 0; - // $result = $ch->pop(10); } return $result; @@ -406,7 +409,7 @@ protected function beforeExecute(): bool * * @return int|mixed */ - abstract protected function execute($input, $output); + abstract protected function execute(Input $input, Output $output); /** * After command execute @@ -499,9 +502,13 @@ public function loadRulesByDocblock(string $method, FlagsParser $fs): void $dr = DocblockRules::newByDocblock($rftMth->getDocComment()); $dr->parse(); - $fs->setDesc($dr->getTagValue('desc') ?: self::getDesc()); $fs->addArgsByRules($dr->getArgRules()); $fs->addOptsByRules($dr->getOptRules()); + + // more info + $fs->setDesc($dr->getTagValue('desc'), true); + $fs->setMoreHelp($dr->getTagValue('help')); + $fs->setExample($dr->getTagValue('example')); } /********************************************************** diff --git a/src/Handler/CallableCommand.php b/src/Handler/CallableCommand.php index 54067a9..f65ac84 100644 --- a/src/Handler/CallableCommand.php +++ b/src/Handler/CallableCommand.php @@ -57,7 +57,7 @@ public function setCallable(callable $callable): self * * @return int|mixed */ - protected function execute($input, $output) + protected function execute(Input $input, Output $output) { if (!$call = $this->callable) { throw new \BadMethodCallException('The callable property is empty'); diff --git a/src/Router.php b/src/Router.php index fe44118..1be0404 100644 --- a/src/Router.php +++ b/src/Router.php @@ -156,14 +156,14 @@ public function addGroup(string $name, $class = null, array $options = []): Rout */ public function addCommand(string $name, $handler = null, array $options = []): RouterInterface { - /** - * @var Command $name name is an command class - */ if (!$handler && class_exists($name)) { $handler = $name; $name = $name::getName(); } + /** + * @var Command $name name is an command class + */ if (!$name || !$handler) { Helper::throwInvalidArgument("Command 'name' and 'handler' cannot be empty! name: $name"); } @@ -311,7 +311,7 @@ public function match(string $name): array **********************************************************/ /** - * @param $name + * @param string $name * * @throws InvalidArgumentException */ @@ -376,7 +376,7 @@ public function getControllers(): array } /** - * @param $name + * @param string $name * * @return array */ @@ -386,7 +386,7 @@ public function getControllerInfo(string $name): array } /** - * @param $name + * @param string $name * * @return bool */ @@ -404,7 +404,7 @@ public function getCommands(): array } /** - * @param $name + * @param string $name * * @return bool */ diff --git a/test/TestCommand.php b/test/TestCommand.php index 2dcdb38..5c6aaf1 100644 --- a/test/TestCommand.php +++ b/test/TestCommand.php @@ -31,7 +31,7 @@ class TestCommand extends Command * * @return int|mixed */ - protected function execute($input, $output) + protected function execute(Input $input, Output $output) { return __METHOD__; }