Mercurial > hg > isophonics-drupal-site
diff vendor/consolidation/annotated-command/src/Parser/Internal/BespokeDocBlockParser.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line diff
--- a/vendor/consolidation/annotated-command/src/Parser/Internal/BespokeDocBlockParser.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/consolidation/annotated-command/src/Parser/Internal/BespokeDocBlockParser.php Thu Feb 28 13:21:36 2019 +0000 @@ -20,7 +20,7 @@ 'command' => 'processCommandTag', 'name' => 'processCommandTag', 'arg' => 'processArgumentTag', - 'param' => 'processArgumentTag', + 'param' => 'processParamTag', 'return' => 'processReturnTag', 'option' => 'processOptionTag', 'default' => 'processDefaultTag', @@ -84,6 +84,31 @@ } /** + * Store the data from a @param annotation in our argument descriptions. + */ + protected function processParamTag($tag) + { + if ($tag->hasTypeVariableAndDescription($matches)) { + if ($this->ignoredParamType($matches['type'])) { + return; + } + } + return $this->processArgumentTag($tag); + } + + protected function ignoredParamType($paramType) + { + // TODO: We should really only allow a couple of types here, + // e.g. 'string', 'array', 'bool'. Blacklist things we do not + // want for now to avoid breaking commands with weird types. + // Fix in the next major version. + // + // This works: + // return !in_array($paramType, ['string', 'array', 'integer', 'bool']); + return preg_match('#(InputInterface|OutputInterface)$#', $paramType); + } + + /** * Store the data from a @arg annotation in our argument descriptions. */ protected function processArgumentTag($tag)