We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! I use .env variables in my project and see these warnings when running phpstan:
I created a bootstrap file with the following code:
$dotenv = new \Symfony\Component\Dotenv\Dotenv(); $dotenv->load(__DIR__.'/.env.test');
and add it to config
There are lines like this: 'dsn' =>$_ENV['DB_TEST_DSN']
'dsn' =>$_ENV['DB_TEST_DSN']
in config/test_db.php, and I require this file ./config/test.php
The text was updated successfully, but these errors were encountered:
The $dotenv->load() exposes the variables at runtime, while phpstan analyses statically.
$dotenv->load()
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
$_ENV['DB_TEST_DSN'] = 'mysql:host=localhost'; $_ENV['DB_TEST_CONNECTION'] = 'foo';
Sorry, something went wrong.
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: