|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types = 1); |
|
3
|
|
|
|
|
4
|
|
|
namespace Innmind\Immutable; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* @template T |
|
8
|
|
|
* |
|
9
|
|
|
* @param Set<T>|Sequence<T> $structure |
|
10
|
|
|
* |
|
11
|
|
|
* @return list<T> |
|
|
|
|
|
|
12
|
|
|
*/ |
|
13
|
|
|
function unwrap($structure): array |
|
14
|
|
|
{ |
|
15
|
|
|
/** @psalm-suppress DocblockTypeContradiction */ |
|
16
|
7 |
|
if (!$structure instanceof Set && !$structure instanceof Sequence) { |
|
|
|
|
|
|
17
|
1 |
|
$given = Type::determine($structure); |
|
18
|
|
|
|
|
19
|
1 |
|
throw new \TypeError("Argument 1 must be of type Set|Sequence, $given given"); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @psalm-suppress MixedAssignment |
|
24
|
|
|
* |
|
25
|
|
|
* @var list<T> |
|
26
|
|
|
*/ |
|
27
|
6 |
|
return $structure->reduce( |
|
|
|
|
|
|
28
|
6 |
|
[], |
|
|
|
|
|
|
29
|
|
|
static function(array $carry, $t): array { |
|
30
|
6 |
|
$carry[] = $t; |
|
31
|
|
|
|
|
32
|
6 |
|
return $carry; |
|
33
|
6 |
|
}, |
|
34
|
|
|
); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @throws \TypeError |
|
39
|
|
|
*/ |
|
40
|
|
|
function assertSet(string $type, Set $set, int $position): void |
|
41
|
|
|
{ |
|
42
|
16 |
|
if (!$set->isOfType($type)) { |
|
43
|
5 |
|
throw new \TypeError("Argument $position must be of type Set<$type>, Set<{$set->type()}> given"); |
|
44
|
|
|
} |
|
45
|
12 |
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @throws \TypeError |
|
49
|
|
|
*/ |
|
50
|
|
|
function assertMap(string $key, string $value, Map $map, int $position): void |
|
51
|
|
|
{ |
|
52
|
9 |
|
if (!$map->isOfType($key, $value)) { |
|
53
|
3 |
|
throw new \TypeError("Argument $position must be of type Map<$key, $value>, Map<{$map->keyType()}, {$map->valueType()}> given"); |
|
54
|
|
|
} |
|
55
|
7 |
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @throws \TypeError |
|
59
|
|
|
*/ |
|
60
|
|
|
function assertSequence(string $type, Sequence $sequence, int $position): void |
|
61
|
|
|
{ |
|
62
|
31 |
|
if (!$sequence->isOfType($type)) { |
|
63
|
4 |
|
throw new \TypeError("Argument $position must be of type Sequence<$type>, Sequence<{$sequence->type()}> given"); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
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