1 | <?php |
||
2 | use Symfony\Component\Dotenv\Dotenv; |
||
3 | require dirname(__DIR__).'/vendor/autoload.php'; |
||
4 | // Load cached env vars if the .env.local.php file exists |
||
5 | // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) |
||
6 | if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { |
||
7 | $_ENV += $env; |
||
8 | } elseif (!class_exists(Dotenv::class)) { |
||
9 | throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); |
||
10 | } else { |
||
11 | // load all the .env files |
||
12 | (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); |
||
0 ignored issues
–
show
|
|||
13 | } |
||
14 | $_SERVER += $_ENV; |
||
15 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; |
||
16 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; |
||
17 | $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
||
18 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.