1 | <?php |
||
10 | abstract class FixedTypedCollection extends TypedCollection |
||
11 | { |
||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | protected $size; |
||
16 | |||
17 | /** |
||
18 | * @param int $size |
||
19 | * @param array $elements |
||
20 | */ |
||
21 | public function __construct($size, array $elements = []) |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function offsetSet($offset, $value) |
||
40 | |||
41 | /** |
||
42 | * @param int|string $key |
||
43 | * |
||
44 | * @throws \InvalidArgumentException |
||
45 | * |
||
46 | * @return mixed|null |
||
47 | */ |
||
48 | public function get($key) |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | public function offsetGet($offset) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function add($value) |
||
73 | |||
74 | /** |
||
75 | * @throws \InvalidArgumentException |
||
76 | */ |
||
77 | protected function validateSize() |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function matching(Criteria $criteria) |
||
116 | } |
||
117 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: