Open Julielesss opened 1 year ago
The $dotenv->load()
exposes the variables at runtime, while phpstan analyses statically.
It's probably better to just set all of those $_ENV
values you use to a dummy value in the boostrap.php directly, without relying on dotenv, e.g:
$_ENV['DB_TEST_DSN'] = 'mysql:host=localhost';
$_ENV['DB_TEST_CONNECTION'] = 'foo';
Hi! I use .env variables in my project and see these warnings when running phpstan:
I created a bootstrap file with the following code:
and add it to config
There are lines like this:
'dsn' =>$_ENV['DB_TEST_DSN']
in config/test_db.php, and I require this file ./config/test.php