[ErrorHandler] fix parsing @return array<foo>
annotations
This commit is contained in:
parent
6c8114ad2a
commit
b8cbb93caa
@ -612,7 +612,7 @@ class DebugClassLoader
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== ($returnType = self::$returnTypes[$class][$method->name] ?? self::MAGIC_METHODS[$method->name] ?? null) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +(\S+)/', $doc))) {
|
if (null !== ($returnType = self::$returnTypes[$class][$method->name] ?? self::MAGIC_METHODS[$method->name] ?? null) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc))) {
|
||||||
[$normalizedType, $returnType, $declaringClass, $declaringFile] = \is_string($returnType) ? [$returnType, $returnType, '', ''] : $returnType;
|
[$normalizedType, $returnType, $declaringClass, $declaringFile] = \is_string($returnType) ? [$returnType, $returnType, '', ''] : $returnType;
|
||||||
|
|
||||||
if ('void' === $normalizedType) {
|
if ('void' === $normalizedType) {
|
||||||
@ -640,7 +640,7 @@ class DebugClassLoader
|
|||||||
|
|
||||||
$matches = [];
|
$matches = [];
|
||||||
|
|
||||||
if (!$method->hasReturnType() && ((false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +(\S+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
|
if (!$method->hasReturnType() && ((false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
|
||||||
$matches = $matches ?: [1 => self::MAGIC_METHODS[$method->name]];
|
$matches = $matches ?: [1 => self::MAGIC_METHODS[$method->name]];
|
||||||
$this->setReturnType($matches[1], $method, $parent);
|
$this->setReturnType($matches[1], $method, $parent);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user