Both the $myVar assignment in line 1 and the $higher assignment in line 2
are dead. The first because $myVar is never used and the second because
$higher is always overwritten for every possible time line.
Loading history...
34
}
35
36
public function testdoIterateOnArray() {
37
38
$expected = array(
39
1 , 42
40
);
41
42
$mappingIterator = new MappingIterator( $expected, function( $counter ) {
43
return $counter;
44
} );
45
46
foreach ( $mappingIterator as $key => $value ) {
47
$this->assertEquals(
48
$expected[$key],
49
$value
50
);
51
}
52
}
53
54
public function testdoIterateOnArrayIterator() {
55
56
$expected = array(
57
1001 , 42
58
);
59
60
$mappingIterator = new MappingIterator( new ArrayIterator( $expected ), function( $counter ) {
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: