From d4a4887838408a8bd35c63f0af5efea05323163b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Pustu=C5=82ka?= Date: Thu, 15 Feb 2018 14:26:14 +0100 Subject: [PATCH] Fix more issues reported by PHPStan --- src/Console/CommandRunner.php | 6 ++---- src/Http/BaseApplication.php | 3 +-- src/Http/Server.php | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Console/CommandRunner.php b/src/Console/CommandRunner.php index c01004a2e5a..cca60a2f17f 100644 --- a/src/Console/CommandRunner.php +++ b/src/Console/CommandRunner.php @@ -25,7 +25,6 @@ use Cake\Core\PluginApplicationInterface; use Cake\Event\EventDispatcherInterface; use Cake\Event\EventDispatcherTrait; -use Cake\Event\EventManagerTrait; use Cake\Utility\Inflector; use RuntimeException; @@ -114,9 +113,8 @@ public function setAliases(array $aliases) */ public function run(array $argv, ConsoleIo $io = null) { - $hasPlugins = $this->app instanceof PluginApplicationInterface; $this->app->bootstrap(); - if ($hasPlugins) { + if ($this->app instanceof PluginApplicationInterface) { $this->app->pluginBootstrap(); } @@ -125,7 +123,7 @@ public function run(array $argv, ConsoleIo $io = null) 'help' => HelpCommand::class, ]); $commands = $this->app->console($commands); - if ($hasPlugins) { + if ($this->app instanceof PluginApplicationInterface) { $commands = $this->app->pluginConsole($commands); } diff --git a/src/Http/BaseApplication.php b/src/Http/BaseApplication.php index 67285f14c00..eabbdf2aae7 100644 --- a/src/Http/BaseApplication.php +++ b/src/Http/BaseApplication.php @@ -18,7 +18,6 @@ use Cake\Core\HttpApplicationInterface; use Cake\Core\Plugin; use Cake\Core\PluginApplicationInterface; -use Cake\Core\PluginCollection; use Cake\Core\PluginInterface; use Cake\Routing\DispatcherFactory; use Cake\Routing\Router; @@ -47,7 +46,7 @@ abstract class BaseApplication implements /** * Plugin Collection * - * @param \Cake\Core\PluginCollection + * @var \Cake\Core\PluginCollection */ protected $plugins; diff --git a/src/Http/Server.php b/src/Http/Server.php index 65535729c15..978246b6958 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -70,8 +70,7 @@ public function __construct(HttpApplicationInterface $app) public function run(ServerRequestInterface $request = null, ResponseInterface $response = null) { $this->app->bootstrap(); - $hasPlugins = $this->app instanceof PluginApplicationInterface; - if ($hasPlugins) { + if ($this->app instanceof PluginApplicationInterface) { $this->app->pluginBootstrap(); } @@ -79,7 +78,7 @@ public function run(ServerRequestInterface $request = null, ResponseInterface $r $request = $request ?: ServerRequestFactory::fromGlobals(); $middleware = $this->app->middleware(new MiddlewareQueue()); - if ($hasPlugins) { + if ($this->app instanceof PluginApplicationInterface) { $middleware = $this->app->pluginMiddleware($middleware); }