File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 88use Symfony \Contracts \Service \ResetInterface ;
99use function PHPPM \register_file ;
1010use Symfony \Component \HttpKernel \KernelInterface ;
11+ use Symfony \Component \Dotenv \Dotenv ;
1112
1213/**
1314 * A default bootstrap for the Symfony framework
@@ -53,8 +54,13 @@ public function getApplication()
5354 }
5455
5556 // 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+ }
5864 }
5965
6066 $ namespace = getenv ('APP_KERNEL_NAMESPACE ' ) ?: '\App \\' ;
You can’t perform that action at this time.
0 commit comments