Innmind /
Immutable
| 1 | <?php |
||
| 2 | declare(strict_types = 1); |
||
| 3 | |||
| 4 | namespace Innmind\Immutable\Maybe; |
||
| 5 | |||
| 6 | use Innmind\Immutable\Maybe; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @psalm-immutable |
||
| 10 | */ |
||
| 11 | final class Comprehension |
||
| 12 | { |
||
| 13 | private Maybe $first; |
||
| 14 | /** @var list<Maybe> */ |
||
|
0 ignored issues
–
show
|
|||
| 15 | private array $rest; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @no-named-arguments |
||
| 19 | */ |
||
| 20 | private function __construct(Maybe $first, Maybe ...$rest) |
||
| 21 | { |
||
| 22 | $this->first = $first; |
||
| 23 | $this->rest = $rest; |
||
|
0 ignored issues
–
show
It seems like
$rest of type array<integer,Innmind\Immutable\Maybe> is incompatible with the declared type Innmind\Immutable\Maybe\list of property $rest.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @internal |
||
| 28 | * @psalm-pure |
||
| 29 | * @no-named-arguments |
||
| 30 | */ |
||
| 31 | public static function of(Maybe $first, Maybe ...$rest): self |
||
| 32 | { |
||
| 33 | return new self($first, ...$rest); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @template T |
||
| 38 | * |
||
| 39 | * @param callable(...mixed): T $map |
||
| 40 | * |
||
| 41 | * @return Maybe<T> |
||
| 42 | */ |
||
| 43 | public function map(callable $map): Maybe |
||
| 44 | { |
||
| 45 | return $this->collapse()->map(static fn(array $args) => $map(...$args)); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @template T |
||
| 50 | * |
||
| 51 | * @param callable(...mixed): Maybe<T> $map |
||
| 52 | * |
||
| 53 | * @return Maybe<T> |
||
| 54 | */ |
||
| 55 | public function flatMap(callable $map): Maybe |
||
| 56 | { |
||
| 57 | return $this->collapse()->flatMap(static fn(array $args) => $map(...$args)); |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return Maybe<list<mixed>> |
||
| 62 | */ |
||
| 63 | private function collapse(): Maybe |
||
| 64 | { |
||
| 65 | /** |
||
| 66 | * @psalm-suppress MixedArgumentTypeCoercion |
||
| 67 | * @var Maybe<list<mixed>> |
||
| 68 | */ |
||
| 69 | return \array_reduce( |
||
| 70 | $this->rest, |
||
| 71 | static fn(Maybe $carry, Maybe $maybe): Maybe => $carry->flatMap( |
||
| 72 | static fn(array $args) => $maybe->map( |
||
| 73 | static fn($value) => \array_merge($args, [$value]), |
||
| 74 | ), |
||
| 75 | ), |
||
| 76 | $this->first->map(static fn($value) => [$value]), |
||
| 77 | ); |
||
| 78 | } |
||
| 79 | } |
||
| 80 |
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