Issues (92)

src/action/Calculate/ActionCalculateAction.php (1 issue)

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