Performance problem - Rescanning all services during stub registration.
Hi there,
This plugin is causing a large performance penalty which is most obvious on symfony projects with a large amount of services.
This line: https://github.com/psalm/psalm-plugin-symfony/blob/cc89974d16ceda9f7e235e8a74f612e8d3ea44df/src/Handler/ContainerHandler.php#L144 is causing all services to be re-scanned, and is being triggered here: https://github.com/vimeo/psalm/blob/a80d5b736bddfee3e1d261ad3460d9fa8e7879f0/src/Psalm/Config.php#L1811
In my particular use case that's waiting 1 minute plus for thousands of services to be re-scanned - for a simple change to one file.
I have discussed this with @muglug on slack briefly, and the suggestion is that Codebase::queueClassLikeForScanning needs a way to specify that the file to be scanned is not a stub.
Raising here for before that conversation disappears into the ether.
Thanks
Today I've tracked down that this is actually causing a bug, and not just a performance problem.
This is causing all service classes to be marked as not user_defined: https://github.com/vimeo/psalm/blob/e59670ef6856fcabce2629d2fccebaabfb1f4b5c/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php#L229
which triggers extra incorrect errors to surface such as MethodSignatureMismatch, that should never occur.
@muglug @seferov i'm looking to take a look at fixing this. can you provide some guidance? I'm a bit lost on the flow of everything to be honest :)