| 1 | <?php |
||
| 11 | class ReversedIterator extends \IteratorIterator implements FiniteIterableInterface |
||
| 12 | { |
||
| 13 | use FiniteIterableTrait; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param \Iterator $iterable |
||
| 17 | */ |
||
| 18 | 4 | public function __construct(\Iterator $iterable) |
|
| 19 | { |
||
| 20 | 4 | $data = []; |
|
| 21 | 4 | foreach ($iterable as $key => $value) { |
|
| 22 | 3 | $data [] = [$key, $value]; |
|
| 23 | } |
||
| 24 | 4 | parent::__construct(new \ArrayIterator(array_reverse($data))); |
|
| 25 | 4 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritDoc} |
||
| 29 | */ |
||
| 30 | 2 | public function key() |
|
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritDoc} |
||
| 38 | */ |
||
| 39 | 2 | public function current() |
|
| 44 | } |
||
| 45 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.