File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,12 @@ use Symfony\Component\Debug\Debug;
7
7
8
8
set_time_limit (0 );
9
9
10
- require __DIR__ .'/../src/bootstrap.php ' ;
10
+ [ $ env , $ debug ] = require __DIR__ .'/../src/bootstrap.php ' ;
11
11
12
12
if (!class_exists (Application::class)) {
13
13
throw new \RuntimeException ('You need to add "symfony/framework-bundle" as a Composer dependency. ' );
14
14
}
15
15
16
- $ env = $ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? 'dev ' ;
17
- $ debug = (bool ) ($ _SERVER ['APP_DEBUG ' ] ?? $ _ENV ['APP_DEBUG ' ] ?? ('prod ' !== $ env )) && !$ input ->hasParameterOption ('--no-debug ' , true );
18
-
19
16
if ($ debug ) {
20
17
umask (0000 );
21
18
Original file line number Diff line number Diff line change 4
4
use Symfony \Component \Debug \Debug ;
5
5
use Symfony \Component \HttpFoundation \Request ;
6
6
7
- require __DIR__ .'/../src/bootstrap.php ' ;
8
-
9
- $ env = $ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? 'dev ' ;
10
- $ debug = (bool ) ($ _SERVER ['APP_DEBUG ' ] ?? $ _ENV ['APP_DEBUG ' ] ?? ('prod ' !== $ env ));
7
+ [$ env , $ debug ] = require __DIR__ .'/../src/bootstrap.php ' ;
11
8
12
9
if ($ debug ) {
13
10
umask (0000 );
Original file line number Diff line number Diff line change 4
4
5
5
use Symfony \Component \Dotenv \Dotenv ;
6
6
7
- if (class_exists (Dotenv::class)) {
8
- (new Dotenv ())->loadForEnv ($ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? 'dev ' , __DIR__ .'/../.env ' );
9
- } elseif (!isset ($ _SERVER ['APP_ENV ' ]) && !isset ($ _ENV ['APP_ENV ' ])) {
7
+ $ envFromEnv = $ _SERVER ['APP_ENV ' ] ?? $ _ENV ['APP_ENV ' ] ?? null ;
8
+ $ env = $ envFromEnv ?? 'dev ' ;
9
+ $ prod = 'prod ' === $ env ;
10
+
11
+ if (!$ prod && class_exists (Dotenv::class)) {
12
+ (new Dotenv ())->loadForEnv ($ env , __DIR__ .'/../.env ' );
13
+ } elseif (null === $ envFromEnv ) {
10
14
throw new \RuntimeException ('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file. ' );
11
15
}
16
+
17
+ return [$ env , (bool ) ($ _SERVER ['APP_DEBUG ' ] ?? $ _ENV ['APP_DEBUG ' ] ?? (!$ prod ))];
You can’t perform that action at this time.
0 commit comments