Browse Source

Fix errors reported by phpstan

ADmad 6 years ago
parent
commit
b293bb1648
2 changed files with 4 additions and 3 deletions
  1. 1 0
      phpstan.neon
  2. 3 3
      src/TestSuite/MiddlewareDispatcher.php

+ 1 - 0
phpstan.neon

@@ -32,6 +32,7 @@ parameters:
         - "#Parameter \\#2 \\$callback of function array_filter expects callable\\(mixed, mixed\\): bool, 'strlen' given.#"
         - '#Parameter \#1 \$autoload_function of function spl_autoload_register expects#'
         - '#Property Cake\\TestSuite\\ConsoleIntegrationTestCase::\$_[a-z]+ \(Cake\\TestSuite\\Stub\\ConsoleOutput\) does not accept null#'
+        - '#Parameter \#1 \$request of static method Cake\\Routing\\Router::(set|parse)Request\(\) expects Cake\\Http\\ServerRequest, Psr\\Http\\Message\\ServerRequestInterface given#'
         -
             message: '#Call to function method_exists\(\) with string and [^ ]+ will always evaluate to false#'
             path: 'src/Controller/Component/AuthComponent.php'

+ 3 - 3
src/TestSuite/MiddlewareDispatcher.php

@@ -20,11 +20,11 @@ use Cake\Core\HttpApplicationInterface;
 use Cake\Core\PluginApplicationInterface;
 use Cake\Event\EventManager;
 use Cake\Http\Server;
+use Cake\Http\ServerRequest;
 use Cake\Http\ServerRequestFactory;
 use Cake\Routing\Router;
 use LogicException;
 use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\ServerRequestInterface;
 use ReflectionClass;
 use ReflectionException;
 use Zend\Diactoros\Stream;
@@ -143,9 +143,9 @@ class MiddlewareDispatcher
      * Create a PSR7 request from the request spec.
      *
      * @param array $spec The request spec.
-     * @return \Psr\Http\Message\ServerRequestInterface
+     * @return \Cake\Http\ServerRequest
      */
-    protected function _createRequest(array $spec): ServerRequestInterface
+    protected function _createRequest(array $spec): ServerRequest
     {
         if (isset($spec['input'])) {
             $spec['post'] = [];