Skip to content

Commit 420aef6

Browse files
Merge branch '4.4' into 5.2
* 4.4: [ErrorHandler] fix parsing `@return array<foo>` annotations
2 parents 11e7260 + 0b10ecb commit 420aef6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DebugClassLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
611611
;
612612
}
613613

614-
if (null !== ($returnType = self::$returnTypes[$class][$method->name] ?? self::MAGIC_METHODS[$method->name] ?? null) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +(\S+)/', $doc))) {
614+
if (null !== ($returnType = self::$returnTypes[$class][$method->name] ?? self::MAGIC_METHODS[$method->name] ?? null) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc))) {
615615
[$normalizedType, $returnType, $declaringClass, $declaringFile] = \is_string($returnType) ? [$returnType, $returnType, '', ''] : $returnType;
616616

617617
if ('void' === $normalizedType) {
@@ -639,7 +639,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
639639

640640
$matches = [];
641641

642-
if (!$method->hasReturnType() && ((false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +(\S+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
642+
if (!$method->hasReturnType() && ((false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
643643
$matches = $matches ?: [1 => self::MAGIC_METHODS[$method->name]];
644644
$this->setReturnType($matches[1], $method, $parent);
645645

0 commit comments

Comments
 (0)