Bug report
I encountered a strange spurious PHPStan error in the following setting:
// Any non-global namespace block ...
namespace foo {
// ...
}
// ... followed by a global namespace block ...
namespace {
// ... and a function declaration here with completed type information in phpdoc
// will trigger the spurious error:
/** @return list<string> */
function qux(): array { // <-- ??? `missingType.iterableValue` error
return [ random_bytes(16) ];
}
\PHPStan\dumpType(qux()); // ok: list<string>
}
(If you are curious: I encountered this issue in my stub file, and I’ve worked around it by reordering the namespace blocks.)
Code snippet that reproduces the problem
https://phpstan.org/r/c714d401-a96b-4e88-b0c8-8ad956180e61
Expected output
No error on line 15.
Did PHPStan help you today? Did it make you happy in any way?
No response