Skip to content

Commit ce81ea2

Browse files
Fix when detecting symfony/dotenv in newer versions of PHP
1 parent accff18 commit ce81ea2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/DotEnvAdapters/DotEnvAdapterPicker.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ public static function detectSymfonyDotEnv()
9090
// to try and detect a change after this so the extra work can be removed, this code looks for the 'void'
9191
// return type in the Dotenv::load(..) method which was added in version 4.0.0
9292
$reflectionMethod = new ReflectionMethod(SymfonyDotenv::class, 'load');
93-
if ((string) $reflectionMethod->getReturnType() == 'void') {
93+
$returnType = $reflectionMethod->getReturnType();
94+
$returnTypeName = !is_null($returnType) ? $returnType->getName() : null;
95+
if ($returnTypeName == 'void') {
9496
return new SymfonyAdapter4Plus();
9597
}
9698
return new SymfonyAdapter3();

src/FluentDotEnv.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public function get($key)
483483
/**
484484
* Return the value, cast to a boolean.
485485
*
486-
* (Will return null if it isn't an "boolean string").
486+
* (Will return null if it isn't a "boolean string").
487487
*
488488
* @param string|string[] $key The key to get the value for.
489489
* @return boolean|boolean[]|null
@@ -538,7 +538,7 @@ private function retrieveValues(array $keys, $castMethod, bool $needsArray)
538538
/**
539539
* Return the value, cast as a boolean.
540540
*
541-
* (Will return null if it isn't an "boolean string").
541+
* (Will return null if it isn't a "boolean string").
542542
*
543543
* @param string $value The value to cast.
544544
* @return boolean|null

0 commit comments

Comments
 (0)