1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace Innmind\Immutable\Either; |
||
5 | |||
6 | use Innmind\Immutable\{ |
||
7 | Either, |
||
8 | Maybe, |
||
9 | }; |
||
10 | |||
11 | /** |
||
12 | * @template L1 |
||
13 | * @template R1 |
||
14 | * @implements Implementation<L1, R1> |
||
15 | * @psalm-immutable |
||
16 | * @internal |
||
17 | */ |
||
18 | final class Right implements Implementation |
||
19 | { |
||
20 | /** @var R1 */ |
||
0 ignored issues
–
show
|
|||
21 | private $value; |
||
22 | |||
23 | /** |
||
24 | * @param R1 $value |
||
25 | */ |
||
26 | public function __construct($value) |
||
27 | { |
||
28 | $this->value = $value; |
||
29 | } |
||
30 | |||
31 | public function map(callable $map): self |
||
32 | { |
||
33 | return new self($map($this->value)); |
||
34 | } |
||
35 | |||
36 | public function flatMap(callable $map): Either |
||
37 | { |
||
38 | return $map($this->value); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @template T |
||
43 | * |
||
44 | * @param callable(L1): T $map |
||
45 | * |
||
46 | * @return self<T, R1> |
||
47 | */ |
||
48 | public function leftMap(callable $map): self |
||
49 | { |
||
50 | /** @var self<T, R1> */ |
||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | public function match(callable $right, callable $left) |
||
55 | { |
||
56 | return $right($this->value); |
||
57 | } |
||
58 | |||
59 | public function otherwise(callable $otherwise): Either |
||
60 | { |
||
61 | return Either::right($this->value); |
||
62 | } |
||
63 | |||
64 | public function filter(callable $predicate, callable $otherwise): Implementation |
||
65 | { |
||
66 | if ($predicate($this->value) === true) { |
||
67 | return $this; |
||
68 | } |
||
69 | |||
70 | return new Left($otherwise()); |
||
71 | } |
||
72 | |||
73 | public function maybe(): Maybe |
||
74 | { |
||
75 | return Maybe::just($this->value); |
||
76 | } |
||
77 | } |
||
78 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths