Don't try to match on false
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
aa060f5332
commit
4859775893
|
@ -47,28 +47,30 @@ class ControllerMethodReflector implements IControllerMethodReflector {
|
||||||
$reflection = new \ReflectionMethod($object, $method);
|
$reflection = new \ReflectionMethod($object, $method);
|
||||||
$docs = $reflection->getDocComment();
|
$docs = $reflection->getDocComment();
|
||||||
|
|
||||||
// extract everything prefixed by @ and first letter uppercase
|
if ($docs !== false) {
|
||||||
preg_match_all('/^\h+\*\h+@(?P<annotation>[A-Z]\w+)((?P<parameter>.*))?$/m', $docs, $matches);
|
// extract everything prefixed by @ and first letter uppercase
|
||||||
foreach($matches['annotation'] as $key => $annontation) {
|
preg_match_all('/^\h+\*\h+@(?P<annotation>[A-Z]\w+)((?P<parameter>.*))?$/m', $docs, $matches);
|
||||||
$annotationValue = $matches['parameter'][$key];
|
foreach ($matches['annotation'] as $key => $annontation) {
|
||||||
if(isset($annotationValue[0]) && $annotationValue[0] === '(' && $annotationValue[\strlen($annotationValue) - 1] === ')') {
|
$annotationValue = $matches['parameter'][$key];
|
||||||
$cutString = substr($annotationValue, 1, -1);
|
if (isset($annotationValue[0]) && $annotationValue[0] === '(' && $annotationValue[\strlen($annotationValue) - 1] === ')') {
|
||||||
$cutString = str_replace(' ', '', $cutString);
|
$cutString = substr($annotationValue, 1, -1);
|
||||||
$splittedArray = explode(',', $cutString);
|
$cutString = str_replace(' ', '', $cutString);
|
||||||
foreach($splittedArray as $annotationValues) {
|
$splittedArray = explode(',', $cutString);
|
||||||
list($key, $value) = explode('=', $annotationValues);
|
foreach ($splittedArray as $annotationValues) {
|
||||||
$this->annotations[$annontation][$key] = $value;
|
list($key, $value) = explode('=', $annotationValues);
|
||||||
|
$this->annotations[$annontation][$key] = $value;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
|
$this->annotations[$annontation] = [$annotationValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->annotations[$annontation] = [$annotationValue];
|
// extract type parameter information
|
||||||
|
preg_match_all('/@param\h+(?P<type>\w+)\h+\$(?P<var>\w+)/', $docs, $matches);
|
||||||
|
$this->types = array_combine($matches['var'], $matches['type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract type parameter information
|
|
||||||
preg_match_all('/@param\h+(?P<type>\w+)\h+\$(?P<var>\w+)/', $docs, $matches);
|
|
||||||
$this->types = array_combine($matches['var'], $matches['type']);
|
|
||||||
|
|
||||||
foreach ($reflection->getParameters() as $param) {
|
foreach ($reflection->getParameters() as $param) {
|
||||||
// extract type information from PHP 7 scalar types and prefer them
|
// extract type information from PHP 7 scalar types and prefer them
|
||||||
// over phpdoc annotations
|
// over phpdoc annotations
|
||||||
|
|
Loading…
Reference in New Issue