1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace PersonalGalaxy\Calendar\Specification; |
||
5 | |||
6 | use PersonalGalaxy\Calendar\Entity\Agenda\Identity; |
||
7 | use Innmind\Specification\{ |
||
8 | ComparatorInterface, |
||
9 | CompositeInterface, |
||
10 | SpecificationInterface, |
||
11 | NotInterface, |
||
12 | }; |
||
13 | |||
14 | final class Agenda implements ComparatorInterface |
||
15 | { |
||
16 | private $value; |
||
17 | |||
18 | 2 | public function __construct(Identity $identity) |
|
19 | { |
||
20 | 2 | $this->value = (string) $identity; |
|
21 | 2 | } |
|
22 | |||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | 1 | public function property(): string |
|
27 | { |
||
28 | 1 | return 'agenda'; |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 1 | public function sign(): string |
|
35 | { |
||
36 | 1 | return '='; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 1 | public function value() |
|
43 | { |
||
44 | 1 | return $this->value; |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function and(SpecificationInterface $specification): CompositeInterface |
||
51 | { |
||
52 | //not implemented |
||
53 | } |
||
0 ignored issues
–
show
|
|||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function or(SpecificationInterface $specification): CompositeInterface |
||
59 | { |
||
60 | //not implemented |
||
61 | } |
||
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return Innmind\Specification\CompositeInterface . 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
}
}
![]() |
|||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | public function not(): NotInterface |
||
67 | { |
||
68 | //not implemented |
||
69 | } |
||
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return Innmind\Specification\NotInterface . 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
}
}
![]() |
|||
70 | } |
||
71 |
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: