phpstan-symfony icon indicating copy to clipboard operation
phpstan-symfony copied to clipboard

Symfony Plugin breaks bootstrapFiles configuration

Open shyim opened this issue 3 years ago • 5 comments

I have in my bootstrapFiles a file which generates the containerXml file. It looks like the containerXml will be parsed before the bootstrapFiles are executed and so the phpstan command fails always

shyim avatar Aug 11 '22 07:08 shyim

How does it fail?

ondrejmirtes avatar Aug 11 '22 07:08 ondrejmirtes

It just throws an error that it cannot find the xml file

shyim avatar Aug 11 '22 07:08 shyim

For me it looks like that the XmlFactories are too early in the stack constructed before running the bootstrapFiles 🤔

shyim avatar Aug 11 '22 07:08 shyim

Yeah, it's not meant to be used like that, you need to have the XML file generated already when you start PHPStan. You can create an alias in Makefile or Composer scripts so that it happens every time you run PHPStan.

This could be fixed in phpstan-symfony, but you'd have to inspect the stack traces and make sure that the container isn't requested before bootstrapFiles are called.

ondrejmirtes avatar Aug 11 '22 11:08 ondrejmirtes

Yes we have a script but thats annoying in combination with PhpStorm. So when you delete the whole var/cache and then change anything phpstan triggered by phpstorm explodes.

So I would rather have this fixed in the extension :D. I can deliver the stacktrace

shyim avatar Aug 11 '22 11:08 shyim