Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class IsOneOfAssert extends Constraint |
||
17 | { |
||
18 | /** @psalm-param string[] $allowedValues */ |
||
19 | public function __construct(private array $allowedValues) |
||
20 | { |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Returns a string representation of the object. |
||
25 | */ |
||
26 | public function toString(): string |
||
27 | { |
||
28 | $allowedValues = []; |
||
29 | |||
30 | foreach ($this->allowedValues as $value) { |
||
31 | $this->allowedValues[] = VarDumper::create($value)->asString(); |
||
32 | } |
||
33 | |||
34 | $expectedAsString = implode(', ', $allowedValues); |
||
35 | |||
36 | return "is one of $expectedAsString"; |
||
37 | } |
||
38 | |||
39 | protected function matches($other): bool |
||
42 | } |
||
43 | } |
||
44 |