@@ -135,7 +135,7 @@ public function populate(array $values, bool $overrideExistingVars = false): voi
135
135
$ loadedVars = array_flip (explode (', ' , $ _SERVER ['SYMFONY_DOTENV_VARS ' ] ?? $ _ENV ['SYMFONY_DOTENV_VARS ' ] ?? '' ));
136
136
137
137
foreach ($ values as $ name => $ value ) {
138
- $ notHttpName = 0 !== strpos ($ name , 'HTTP_ ' );
138
+ $ notHttpName = ! str_starts_with ($ name , 'HTTP_ ' );
139
139
// don't check existence with getenv() because of thread safety issues
140
140
if (!isset ($ loadedVars [$ name ]) && (!$ overrideExistingVars && (isset ($ _ENV [$ name ]) || (isset ($ _SERVER [$ name ]) && $ notHttpName )))) {
141
141
continue ;
@@ -372,7 +372,7 @@ private function skipEmptyLines()
372
372
373
373
private function resolveCommands (string $ value , array $ loadedVars ): string
374
374
{
375
- if (false === strpos ($ value , '$ ' )) {
375
+ if (! str_contains ($ value , '$ ' )) {
376
376
return $ value ;
377
377
}
378
378
@@ -408,7 +408,7 @@ private function resolveCommands(string $value, array $loadedVars): string
408
408
409
409
$ env = [];
410
410
foreach ($ this ->values as $ name => $ value ) {
411
- if (isset ($ loadedVars [$ name ]) || (!isset ($ _ENV [$ name ]) && !(isset ($ _SERVER [$ name ]) && 0 !== strpos ($ name , 'HTTP_ ' )))) {
411
+ if (isset ($ loadedVars [$ name ]) || (!isset ($ _ENV [$ name ]) && !(isset ($ _SERVER [$ name ]) && ! str_starts_with ($ name , 'HTTP_ ' )))) {
412
412
$ env [$ name ] = $ value ;
413
413
}
414
414
}
@@ -426,7 +426,7 @@ private function resolveCommands(string $value, array $loadedVars): string
426
426
427
427
private function resolveVariables (string $ value , array $ loadedVars ): string
428
428
{
429
- if (false === strpos ($ value , '$ ' )) {
429
+ if (! str_contains ($ value , '$ ' )) {
430
430
return $ value ;
431
431
}
432
432
@@ -461,7 +461,7 @@ private function resolveVariables(string $value, array $loadedVars): string
461
461
$ value = $ this ->values [$ name ];
462
462
} elseif (isset ($ _ENV [$ name ])) {
463
463
$ value = $ _ENV [$ name ];
464
- } elseif (isset ($ _SERVER [$ name ]) && 0 !== strpos ($ name , 'HTTP_ ' )) {
464
+ } elseif (isset ($ _SERVER [$ name ]) && ! str_starts_with ($ name , 'HTTP_ ' )) {
465
465
$ value = $ _SERVER [$ name ];
466
466
} elseif (isset ($ this ->values [$ name ])) {
467
467
$ value = $ this ->values [$ name ];
0 commit comments