ActionCalculateAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 2 1
A __construct() 0 3 1
1
<?php
2
3
namespace hiqdev\billing\hiapi\action\Calculate;
4
5
use hiqdev\billing\hiapi\action\ActionRepository;
6
use hiqdev\php\billing\action\Action;
7
8
class ActionCalculateAction
9
{
10
    /**
11
     * @var ActionRepository
12
     */
13
    private $repo;
14
15
    public function __construct(ActionRepository $repo)
16
    {
17
        $this->repo = $repo;
18
    }
19
20
    public function __invoke(ActionCalculateCommand $command): Action
21
    {
22
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return hiqdev\php\billing\action\Action. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
23
}
24