1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Sunrise\Hydrator\Tests\Fixture; |
||
6 | |||
7 | use ArrayAccess; |
||
8 | use Countable; |
||
9 | use OverflowException; |
||
10 | use ReturnTypeWillChange; |
||
11 | |||
12 | use function count; |
||
13 | |||
14 | /** |
||
15 | * @implements ArrayAccess<TKey, TValue> |
||
16 | * |
||
17 | * @template TKey as array-key |
||
18 | * @template TValue as mixed |
||
19 | */ |
||
20 | class Collection implements ArrayAccess, Countable |
||
21 | { |
||
22 | /** |
||
23 | * @var int<-1, max> |
||
24 | */ |
||
25 | protected const LIMIT = -1; |
||
26 | |||
27 | /** |
||
28 | * @var array<TKey, TValue> |
||
29 | */ |
||
30 | public array $elements = []; |
||
31 | |||
32 | /** |
||
33 | * @param TKey $offset |
||
0 ignored issues
–
show
|
|||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function offsetExists($offset): bool |
||
38 | { |
||
39 | return isset($this->elements[$offset]); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param TKey $offset |
||
44 | * |
||
45 | * @return TValue|null |
||
0 ignored issues
–
show
The type
Sunrise\Hydrator\Tests\Fixture\TValue was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
46 | */ |
||
47 | #[ReturnTypeWillChange] |
||
48 | public function offsetGet($offset) |
||
49 | { |
||
50 | return $this->elements[$offset] ?? null; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param TKey $offset |
||
55 | * @param TValue $value |
||
56 | * |
||
57 | * @return void |
||
58 | * |
||
59 | * @throws OverflowException |
||
60 | */ |
||
61 | public function offsetSet($offset, $value): void |
||
62 | { |
||
63 | if ($this->count() === static::LIMIT) { |
||
64 | throw new OverflowException(); |
||
65 | } |
||
66 | |||
67 | $this->elements[$offset] = $value; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param TKey $offset |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | public function offsetUnset($offset): void |
||
76 | { |
||
77 | unset($this->elements[$offset]); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return int<0, max> |
||
82 | */ |
||
83 | public function count(): int |
||
84 | { |
||
85 | return count($this->elements); |
||
86 | } |
||
87 | } |
||
88 |
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