Completed
Pull Request — master (#20)
by Pavel
10:22
created

RunTestCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 6 1
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * RunTestCommand
13
 */
14
class RunTestCommand extends Command
15
{
16
    /**
17
     * Configuration of command
18
     */
19
    protected function configure()
20
    {
21
        $this
22
            ->setName('run:test')
23
            ->setDescription('Command for run tests')
24
        ;
25
    }
26
27
    /**
28
     * Execute method of command
29
     *
30
     * @param InputInterface $input
31
     * @param OutputInterface $output
32
     *
33
     * @return int|null|void
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        exec('./vendor/bin/codecept run', $result);
38
39
        $output->writeln($result);
0 ignored issues
show
Bug introduced by
It seems like $result can also be of type null; however, Symfony\Component\Consol...putInterface::writeln() does only seem to accept string|array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
40
    }
41
}
42