vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 660 forks source link

Invalid namespace for a declared nested type in an array type #11088

Closed Tigrov closed 1 week ago

Tigrov commented 1 week ago

It does not recognize the correct namespace of a nested type imported from another namespace.

https://psalm.dev/r/e931bdfc45

psalm-github-bot[bot] commented 1 week ago

I found these snippets:

https://psalm.dev/r/e931bdfc45 ```php bar($info['type']); } /** * @psalm-param Type::* $type */ public function bar(string $type): void { } } ``` ``` Psalm output (using commit 16b24bd): ERROR: InvalidArgument - 35:20 - Argument 1 of D\E::bar expects D\Type::*, but 'string' provided ERROR: UndefinedDocblockClass - 39:21 - Docblock-defined class, interface or enum named D\Type does not exist ERROR: MismatchingDocblockParamType - 39:21 - Parameter $type has wrong type 'D\Type::*', should be 'string' ```
Tigrov commented 1 week ago

Not relevant, found where the error was.