Reprocess missing class-like storage events#10724
Reprocess missing class-like storage events#10724ohader wants to merge 4 commits intovimeo:masterfrom
Conversation
In case not all class storage items were available during a given file scan, those failed files will be rescanned later with more populated details in the codebase. There's a maximum of 10 rescans to avoid endless recursions.
This comment was marked as off-topic.
This comment was marked as off-topic.
I wonder if rescanning whole files is really necessary. My idea was to walk classlikes / functionlikes after the codebase population and tighten the intersections. E.g. if the return method was left as |
I had something similar in my mind as well, but did not find a good way to "communicate" from the specific inner parts to the outer parts that would trigger those optimizations after codebase population. Basically like:
|
|
I would have tested if this attempt makes a difference for the crash I still have, but unfortunately you branched it from psalm 6 instead of 5 which I not yet are able to install. |
Uh, sorry... I usually start working in → |

The scenario described in #10350 fails, since not all other references used in intersection types were complete resolved when scanning a particular file. Instead of catching exceptions during the type resolution process - which would just "mute" the problem and drop important information - those failures in resolving class-like storages are tracked for a potential rescanning.
This PR does the following:
ClassStorageNotFoundException(instead of globalInvalidArgumentException) to handle missing class-like storage references specifically$files_to_rescanfor later processing\Psalm\Internal\Codebase\Scanner::scanAPath()- whether scan was successfulCodebase::scanFiles()to actually reprocess those files to be rescanned - after changes of the previous run were populated to the codebaseCould not get class storage for <interface>#10350Fixes: #7520
Fixes: #10350
Fixes: #10152
TODO
\Psalm\Internal\Codebase\Scanner::scanAPath()return type in forked processes - currently only tested with$pool_size = 1in test cases