1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #4083 - namespace docblock method classes the proper way

This commit is contained in:
Brown 2020-08-29 11:46:24 -04:00 committed by Daniil Gentili
parent c045c1b077
commit e5e50926d4
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 18 additions and 1 deletions

View File

@ -1123,7 +1123,9 @@ class CommentAnalyzer
'Badly-formatted @method string ' . $method_entry . ' - ' . $e 'Badly-formatted @method string ' . $method_entry . ' - ' . $e
); );
} }
$docblock_lines[] = '@param \\' . $param_type . ' '
$param_type_string = $param_type->toNamespacedString('\\', [], null, false);
$docblock_lines[] = '@param ' . $param_type_string . ' '
. ($method_tree_child->variadic ? '...' : '') . ($method_tree_child->variadic ? '...' : '')
. $method_tree_child->name; . $method_tree_child->name;
} }

View File

@ -694,6 +694,21 @@ class MagicMethodAnnotationTest extends TestCase
(new \Foo\G)->randomInt(); (new \Foo\G)->randomInt();
}' }'
], ],
'namespacedUnion' => [
'<?php
namespace Foo;
/**
* @method string bar(\DateTimeInterface|\DateInterval|self $a, Cache|\Exception $e)
*/
class Cache {
public function __call(string $method, array $args) {
return $method;
}
}
(new Cache)->bar(new \DateTime(), new Cache());'
],
]; ];
} }