Let's say we have a file that looks like this:
class A
{
}
function b()
{
}
const C = 1;
Once the PHP runtime autoloads the class A, it also knows about b() and C which traditionally cannot be autoloaded and wouldn't be discovered otherwise.
AutoloadSourceLocator should parse the file with A before creating the Reflection and when asked about b() and C, it should report them as known.
I understand if you don't want this change - it makes the behaviour non-deterministic - if the user asks first about b(), it will not be known. But I needed this to make the static reflection's behaviour as close to runtime reflection as possible.
PoC implementation: phpstan/phpstan-src@25c7791#diff-b84fb81e70db3cdb6b4495c80b475a44