Completed
Push — master ( 5f7cf8...52a49e )
by Sebastian
02:18
created

Symfony   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 1
1
<?php
2
/**
3
 * This file is part of SebastianFeldmann\Cli.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Cli\Processor;
11
12
use RuntimeException;
13
use SebastianFeldmann\Cli\Command\Result;
14
use SebastianFeldmann\Cli\Processor;
15
use Symfony\Component\Process\Process;
16
17
/**
18
 * Class ProcOpen
19
 *
20
 * @package SebastianFeldmann\Cli
21
 * @author  Sebastian Feldmann <[email protected]>
22
 * @link    https://github.com/sebastianfeldmann/cli
23
 * @since   Class available since Release 3.2.2
24
 */
25
class Symfony implements Processor
26
{
27
    /**
28
     * Execute the command
29
     *
30
     * @param  string $cmd
31
     * @param  int[]  $acceptableExitCodes
32
     * @return \SebastianFeldmann\Cli\Command\Result
33
     */
34 3
    public function run(string $cmd, array $acceptableExitCodes = [0]) : Result
35
    {
36 3
        $process = new Process($cmd);
0 ignored issues
show
Documentation introduced by
$cmd is of type string, but the function expects a array.

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...
37 3
        $process->run();
38 3
        return new Result(
39 3
            $cmd,
40 3
            $process->getExitCode(),
41 3
            $process->getOutput(),
42 3
            $process->getErrorOutput(),
43 3
            '',
44
            $acceptableExitCodes
45
        );
46
    }
47
}
48