Browse Source

Fix up include of config via defaulting.

mscherer 7 years ago
parent
commit
671ff53454
2 changed files with 3 additions and 2 deletions
  1. 0 1
      phpstan.neon
  2. 3 1
      src/Core/Configure/Engine/PhpConfig.php

+ 0 - 1
phpstan.neon

@@ -17,7 +17,6 @@ parameters:
         - '#Access to an undefined property Exception::\$queryString#'
         - '#Access to an undefined property Exception::\$queryString#'
         - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
         - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
         - '#Call to an undefined method Traversable::getArrayCopy().#'
         - '#Call to an undefined method Traversable::getArrayCopy().#'
-        - '#Variable \$config in isset\(\) is never defined#'
         - '#Call to static method id\(\) on an unknown class PHPUnit_Runner_Version#'
         - '#Call to static method id\(\) on an unknown class PHPUnit_Runner_Version#'
         - '#Call to an undefined method DateTimeInterface::i18nFormat\(\)#'
         - '#Call to an undefined method DateTimeInterface::i18nFormat\(\)#'
         - '#Cannot call method lastInsertId\(\) on null#'
         - '#Cannot call method lastInsertId\(\) on null#'

+ 3 - 1
src/Core/Configure/Engine/PhpConfig.php

@@ -85,12 +85,14 @@ class PhpConfig implements ConfigEngineInterface
     {
     {
         $file = $this->_getFilePath($key, true);
         $file = $this->_getFilePath($key, true);
 
 
+        $config = null;
+
         $return = include $file;
         $return = include $file;
         if (is_array($return)) {
         if (is_array($return)) {
             return $return;
             return $return;
         }
         }
 
 
-        if (!isset($config)) {
+        if ($config === null) {
             throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php'));
             throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php'));
         }
         }
         deprecationWarning(sprintf(
         deprecationWarning(sprintf(