GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PromoteEmployeeHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the AL labs package
6
 *
7
 * (c) Arnaud Langlade
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Al\ResourceManagement\Application\Handler;
14
15
use Al\ResourceManagement\Application\Command\PromoteEmployee;
16
use Al\ResourceManagement\Domain\EmployeeRepositoryInterface;
17
18
final class PromoteEmployeeHandler
19
{
20
    /** @var EmployeeRepositoryInterface */
21
    private $employeeRepository;
22
23
    /**
24
     * @param EmployeeRepositoryInterface $employeeRepository
25
     */
26
    public function __construct(EmployeeRepositoryInterface $employeeRepository)
27
    {
28
        $this->employeeRepository = $employeeRepository;
29
    }
30
31
    /**
32
     * @param PromoteEmployee $command
33
     */
34
    public function handle(PromoteEmployee $command)
35
    {
36
        $employee = $this->employeeRepository->get($command->id);
0 ignored issues
show
Documentation introduced by
$command->id is of type string, but the function expects a object<Ramsey\Uuid\UuidInterface>.

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
38
        $employee->promote($command->position, (int)$command->salaryScale);
39
40
        $this->employeeRepository->add($employee);
41
    }
42
}
43