1 | <?php |
||
7 | class ArrayAccessTraitTest extends \PHPUnit\Framework\TestCase |
||
8 | { |
||
9 | /** |
||
10 | * Verify basic behavior of offsetSet(). |
||
11 | * |
||
12 | * @test |
||
13 | * @covers ::offsetSet |
||
14 | * |
||
15 | * @return void |
||
16 | */ |
||
17 | public function offsetSet() |
||
31 | |||
32 | /** |
||
33 | * Verify behavior of offsetSet() with key which is not a string or an integer. |
||
34 | * |
||
35 | * @test |
||
36 | * @covers ::offsetSet |
||
37 | * @expectedException \InvalidArgumentException |
||
38 | * @expectedExceptionMessage $offset must be an integer or string |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | public function offsetSetInvalidKey() |
||
47 | |||
48 | /** |
||
49 | * Verify basic behavior of offsetExists(). |
||
50 | * |
||
51 | * @test |
||
52 | * @covers ::offsetExists |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | public function offsetExists() |
||
61 | |||
62 | /** |
||
63 | * Verify behavior of offsetExists() with key that is not an integer or string. |
||
64 | * |
||
65 | * @test |
||
66 | * @covers ::offsetExists |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function offsetExistsInvalidKey() |
||
75 | |||
76 | /** |
||
77 | * Verify basic behavior of offsetUnset(). |
||
78 | * |
||
79 | * @test |
||
80 | * @covers ::offsetUnset |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | public function offsetUnset() |
||
91 | |||
92 | /** |
||
93 | * Verify behavior of offsetGet() with key that is not an integer or string. |
||
94 | * |
||
95 | * @test |
||
96 | * @covers ::offsetGet |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | public function offsetGet() |
||
105 | |||
106 | /** |
||
107 | * Verify behavior of offsetGet() with key which is not a string or an integer. |
||
108 | * |
||
109 | * @test |
||
110 | * @covers ::offsetGet |
||
111 | * @expectedException \InvalidArgumentException |
||
112 | * @expectedExceptionMessage $offset must be an integer or string |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public function offsetGetInvalidKey() |
||
121 | } |
||
122 |
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: