-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Hi..
I have an issue with sf and PHPStan... which I don't know if it is sf or PHPStan..
Until today I had a make
command like this:
phpstan-src:
php bin/console cache:warmup --env=dev
php vendor/bin/phpstan analyse -c phpstan.neon ./src
Why cache warmup? In order to make sure that the container exists and then PHPStan to load it using this
parameters: level: 8 symfony: container_xml_path: %currentWorkingDirectory%/var/cache/dev/App_KernelDevDebugContainer.xml
So far so good.. My problem is that I thought that the above setup is wrong.
I don't want PHPStan to check my sf code using the dev container. I want to do it using the prod container.
So I warmed up my prod container:
APP_ENV=prod APP_DEBUG=0 php bin/console cache:warmup
but the above command did not generate any XML file...in order to include it... 😕
When I switched to this:
APP_ENV=prod APP_DEBUG=1 php bin/console cache:warmup
There is an XML.. it seems that the XML is generated only for debug
.
But still this does not seem as the best solution as it does not fully simulate my prod environment.
I would wish PHPStan to check the code as it will be deployed. So if I use in my code something like this:
$this->container->get('my_debug_service_that_exists_only_on_debug_mode');
$this->container->get('my_dev_service_that_exists_only_on_dev_env');
I need it reported...
So am I missing something? Is there a way to load the prod-non-debug container?