InstallCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 2
1
<?php
2
/**
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\StandardEditionBundle\Command;
14
15
use Symfony\Component\Console\Command\Command;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
use WellCommerce\Bundle\AppBundle\Console\Action\LoadSystemDefaultsAction;
19
use WellCommerce\Bundle\AppBundle\Console\Action\RefreshAdminMenuAction;
20
use WellCommerce\Bundle\CoreBundle\Console\Action\ClearCacheAction;
21
use WellCommerce\Bundle\CoreBundle\Console\Action\InstallAssetsAction;
22
use WellCommerce\Bundle\CoreBundle\Console\Action\InstallDatabaseAction;
23
use WellCommerce\Bundle\CoreBundle\Console\Action\InstallFixturesAction;
24
use WellCommerce\Bundle\CoreBundle\Console\Executor\ConsoleActionExecutorInterface;
25
use WellCommerce\Bundle\SearchBundle\Console\Action\ReindexAction;
26
27
/**
28
 * Class InstallCommand
29
 *
30
 * @author  Adam Piotrowski <[email protected]>
31
 */
32
class InstallCommand extends Command
33
{
34
    /**
35
     * @var ConsoleActionExecutorInterface
36
     */
37
    protected $executor;
38
    
39
    /**
40
     * InstallCommand constructor.
41
     *
42
     * @param ConsoleActionExecutorInterface $executor
43
     */
44
    public function __construct(ConsoleActionExecutorInterface $executor)
45
    {
46
        parent::__construct();
47
        $this->executor = $executor;
48
    }
49
    
50
    protected function configure()
51
    {
52
        $this->setDescription('Installs WellCommerce Standard Edition');
53
        $this->setName('wellcommerce:install');
54
    }
55
    
56
    protected function execute(InputInterface $input, OutputInterface $output)
57
    {
58
        $actions = [
59
            new ClearCacheAction(),
60
            new InstallDatabaseAction(),
61
            new InstallFixturesAction(),
62
            new LoadSystemDefaultsAction(),
63
            new RefreshAdminMenuAction(),
64
            new ReindexAction(),
65
            new InstallAssetsAction(),
66
        ];
67
        
68
        $this->executor->execute($actions, $output);
0 ignored issues
show
Documentation introduced by Adam Piotrowski
$output is of type object<Symfony\Component...Output\OutputInterface>, but the function expects a null|object<Symfony\Comp...ConsoleOutputInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
69
    }
70
}
71