Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
18 */ | 18 */ |
19 protected $tagProcessors = [ | 19 protected $tagProcessors = [ |
20 'command' => 'processCommandTag', | 20 'command' => 'processCommandTag', |
21 'name' => 'processCommandTag', | 21 'name' => 'processCommandTag', |
22 'arg' => 'processArgumentTag', | 22 'arg' => 'processArgumentTag', |
23 'param' => 'processArgumentTag', | 23 'param' => 'processParamTag', |
24 'return' => 'processReturnTag', | 24 'return' => 'processReturnTag', |
25 'option' => 'processOptionTag', | 25 'option' => 'processOptionTag', |
26 'default' => 'processDefaultTag', | 26 'default' => 'processDefaultTag', |
27 'aliases' => 'processAliases', | 27 'aliases' => 'processAliases', |
28 'usage' => 'processUsageTag', | 28 'usage' => 'processUsageTag', |
79 * @deprecated | 79 * @deprecated |
80 */ | 80 */ |
81 protected function processAlternateDescriptionTag($tag) | 81 protected function processAlternateDescriptionTag($tag) |
82 { | 82 { |
83 $this->commandInfo->setDescription($tag->getContent()); | 83 $this->commandInfo->setDescription($tag->getContent()); |
84 } | |
85 | |
86 /** | |
87 * Store the data from a @param annotation in our argument descriptions. | |
88 */ | |
89 protected function processParamTag($tag) | |
90 { | |
91 if ($tag->hasTypeVariableAndDescription($matches)) { | |
92 if ($this->ignoredParamType($matches['type'])) { | |
93 return; | |
94 } | |
95 } | |
96 return $this->processArgumentTag($tag); | |
97 } | |
98 | |
99 protected function ignoredParamType($paramType) | |
100 { | |
101 // TODO: We should really only allow a couple of types here, | |
102 // e.g. 'string', 'array', 'bool'. Blacklist things we do not | |
103 // want for now to avoid breaking commands with weird types. | |
104 // Fix in the next major version. | |
105 // | |
106 // This works: | |
107 // return !in_array($paramType, ['string', 'array', 'integer', 'bool']); | |
108 return preg_match('#(InputInterface|OutputInterface)$#', $paramType); | |
84 } | 109 } |
85 | 110 |
86 /** | 111 /** |
87 * Store the data from a @arg annotation in our argument descriptions. | 112 * Store the data from a @arg annotation in our argument descriptions. |
88 */ | 113 */ |