Completed
Push — master ( 9b8d1b...94a688 )
by Michael
06:16
created

Command::echoNotes()   A

Complexity

Conditions 2
Paths 2

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 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Schnittstabil\Dartisan\Commands;
4
5
use Garden\Cli\Args;
6
use Schnittstabil\Dartisan\Contracts\Output;
7
8
abstract class Command
9
{
10
    /**
11
     * @var Args
12
     */
13
    protected $args;
14
15
    /**
16
     * @var callable
17
     */
18
    protected $output;
19
20
    public function __construct(Args $args, Output $output)
21
    {
22
        $this->args = $args;
23
        $this->output = $output;
0 ignored issues
show
Documentation Bug introduced by
It seems like $output of type object<Schnittstabil\Dartisan\Contracts\Output> is incompatible with the declared type callable of property $output.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
24
    }
25
26
    abstract protected function run();
27
28
    public function __invoke()
29
    {
30
        try {
31
            return $this->run();
32
        } catch (\Exception $e) {
33
            $this->output->error($e);
0 ignored issues
show
Bug introduced by
The method error cannot be called on $this->output (of type callable).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
34
35
            return 2;
36
        }
37
    }
38
}
39