File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 8
8
use Symfony \Contracts \Service \ResetInterface ;
9
9
use function PHPPM \register_file ;
10
10
use Symfony \Component \HttpKernel \KernelInterface ;
11
+ use Symfony \Component \Dotenv \Dotenv ;
11
12
12
13
/**
13
14
* A default bootstrap for the Symfony framework
@@ -53,8 +54,13 @@ public function getApplication()
53
54
}
54
55
55
56
// environment loading as of Symfony 3.3
56
- if (!getenv ('APP_ENV ' ) && class_exists ('Symfony\Component\Dotenv\Dotenv ' ) && file_exists (realpath ('.env ' ))) {
57
- (new \Symfony \Component \Dotenv \Dotenv (true ))->load (realpath ('.env ' ));
57
+ if (!getenv ('APP_ENV ' ) && class_exists (Dotenv::class) && file_exists (realpath ('.env ' ))) {
58
+ //Symfony >=5.1 compatibility
59
+ if (method_exists (Dotenv::class, 'usePutenv ' )) {
60
+ (new Dotenv ())->usePutenv ()->load (realpath ('.env ' ));
61
+ } else {
62
+ (new Dotenv (true ))->load (realpath ('.env ' ));
63
+ }
58
64
}
59
65
60
66
$ namespace = getenv ('APP_KERNEL_NAMESPACE ' ) ?: '\App \\' ;
You can’t perform that action at this time.
0 commit comments