Browse Source

Merge pull request #13051 from cakephp/master-isset

Fix up include of config via defaulting.
Mark Story 7 years ago
parent
commit
712a52d79a
3 changed files with 5 additions and 2 deletions
  1. 0 1
      phpstan.neon
  2. 3 1
      src/Core/Configure/Engine/PhpConfig.php
  3. 2 0
      src/Http/Client/Auth/Oauth.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(

+ 2 - 0
src/Http/Client/Auth/Oauth.php

@@ -48,6 +48,8 @@ class Oauth
             $credentials['method'] = 'hmac-sha1';
         }
         $credentials['method'] = strtoupper($credentials['method']);
+
+        $value = null;
         switch ($credentials['method']) {
             case 'HMAC-SHA1':
                 $hasKeys = isset(