浏览代码

Fix up include of config via defaulting.

mscherer 7 年之前
父节点
当前提交
671ff53454
共有 2 个文件被更改,包括 3 次插入2 次删除
  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 PHPUnit\\Framework\\Test::\$fixtureManager#'
         - '#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 an undefined method DateTimeInterface::i18nFormat\(\)#'
         - '#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);
 
+        $config = null;
+
         $return = include $file;
         if (is_array($return)) {
             return $return;
         }
 
-        if (!isset($config)) {
+        if ($config === null) {
             throw new Exception(sprintf('Config file "%s" did not return an array', $key . '.php'));
         }
         deprecationWarning(sprintf(