Completed
Pull Request — master (#20)
by Pavel
03:11
created

RunTestCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * RunTestCommand
11
 */
12
class RunTestCommand extends Command
13
{
14
    /**
15
     * Configuration of command
16
     */
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('run:test')
21
            ->setDescription('Command for run tests')
22
        ;
23
    }
24
25
    /**
26
     * Execute method of command
27
     *
28
     * @param InputInterface $input
29
     * @param OutputInterface $output
30
     *
31
     * @return int|null|void
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        exec('./vendor/bin/codecept run', $result);
36
37
        $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...
38
    }
39
}
40