1 | <?php |
||
5 | class Flags implements \IteratorAggregate, \Countable |
||
6 | { |
||
7 | protected $valid_flags = []; |
||
8 | protected $flags = []; |
||
9 | |||
10 | 77 | public function __construct(int ...$valid_flags) |
|
14 | |||
15 | 26 | public function getIterator(): array |
|
19 | |||
20 | 37 | public function add($flag) |
|
28 | |||
29 | 1 | public function remove($flag) |
|
35 | |||
36 | 26 | public function hasFlag($flag) |
|
40 | |||
41 | /** |
||
42 | * Count elements of an object |
||
43 | * @link http://php.net/manual/en/countable.count.php |
||
44 | * @return int The custom count as an integer. |
||
45 | * </p> |
||
46 | * <p> |
||
47 | * The return value is cast to an integer. |
||
48 | * @since 5.1.0 |
||
49 | */ |
||
50 | 2 | public function count() |
|
54 | } |
||
55 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: