Merge branch '4.4' into 5.2
* 4.4: [ErrorHandler] fix parsing `@return array<foo>` annotations
This commit is contained in:
commit
6f5e0c09a9
@ -611,7 +611,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;
|
||||
|
||||
if ('void' === $normalizedType) {
|
||||
@ -639,7 +639,7 @@ class DebugClassLoader
|
||||
|
||||
$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]];
|
||||
$this->setReturnType($matches[1], $method, $parent);
|
||||
|
||||
|
Reference in New Issue
Block a user