Skip to content

Commit

Permalink
Fix more issues reported by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed Feb 15, 2018
1 parent 8b33c9f commit d4a4887
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/Console/CommandRunner.php
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}

Expand All @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Http/BaseApplication.php
Expand Up @@ -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;
Expand Down Expand Up @@ -47,7 +46,7 @@ abstract class BaseApplication implements
/**
* Plugin Collection
*
* @param \Cake\Core\PluginCollection
* @var \Cake\Core\PluginCollection
*/
protected $plugins;

Expand Down
5 changes: 2 additions & 3 deletions src/Http/Server.php
Expand Up @@ -70,16 +70,15 @@ 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();
}

$response = $response ?: new Response();
$request = $request ?: ServerRequestFactory::fromGlobals();

$middleware = $this->app->middleware(new MiddlewareQueue());
if ($hasPlugins) {
if ($this->app instanceof PluginApplicationInterface) {
$middleware = $this->app->pluginMiddleware($middleware);
}

Expand Down

0 comments on commit d4a4887

Please sign in to comment.