Innmind /
Immutable
| 1 | <?php |
||||||
| 2 | declare(strict_types = 1); |
||||||
| 3 | |||||||
| 4 | namespace Innmind\Immutable\Monoid; |
||||||
| 5 | |||||||
| 6 | use Innmind\Immutable\{ |
||||||
| 7 | Monoid, |
||||||
| 8 | Map, |
||||||
| 9 | }; |
||||||
| 10 | |||||||
| 11 | /** |
||||||
| 12 | * @template T |
||||||
| 13 | * @template U |
||||||
| 14 | * @psalm-immutable |
||||||
| 15 | * @implements Monoid<Map<T, U>> |
||||||
| 16 | */ |
||||||
| 17 | final class MergeMap implements Monoid |
||||||
| 18 | { |
||||||
| 19 | /** |
||||||
| 20 | * @template A of object |
||||||
| 21 | * @template B of object |
||||||
| 22 | * |
||||||
| 23 | * @param class-string<A> $key |
||||||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||||||
| 24 | * @param class-string<B> $value |
||||||
| 25 | * |
||||||
| 26 | * @return self<A, B> |
||||||
| 27 | */ |
||||||
| 28 | public static function of(string $key = null, string $value = null): self |
||||||
|
0 ignored issues
–
show
The parameter
$value is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$key is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 29 | { |
||||||
| 30 | /** @var self<A, B> */ |
||||||
| 31 | return new self; |
||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | public function identity(): mixed |
||||||
| 35 | { |
||||||
| 36 | /** @var Map<T, U> */ |
||||||
| 37 | return Map::of(); |
||||||
| 38 | } |
||||||
| 39 | |||||||
| 40 | /** |
||||||
| 41 | * @param Map<T, U> $a |
||||||
| 42 | * @param Map<T, U> $b |
||||||
| 43 | * |
||||||
| 44 | * @return Map<T, U> |
||||||
| 45 | */ |
||||||
| 46 | public function combine(mixed $a, mixed $b): mixed |
||||||
| 47 | { |
||||||
| 48 | return $a->merge($b); |
||||||
| 49 | } |
||||||
| 50 | } |
||||||
| 51 |