1 | <?php |
||
27 | class CsvParser implements ParserInterface |
||
28 | { |
||
29 | /** @var CsvFormatInterface */ |
||
30 | private $csvFormat; |
||
31 | /** @var array */ |
||
32 | private $headerRow = []; |
||
33 | |||
34 | /** |
||
35 | * @param CsvFormatInterface $csvFormat |
||
36 | */ |
||
37 | 13 | public function __construct(CsvFormatInterface $csvFormat) |
|
41 | |||
42 | /** |
||
43 | * @param StreamInterface $stream |
||
44 | * |
||
45 | * @return Iterator |
||
46 | */ |
||
47 | 12 | public function parse(StreamInterface $stream) |
|
55 | |||
56 | /** |
||
57 | * Parse a supplied iterator |
||
58 | * |
||
59 | * @param Iterator $iterator |
||
60 | * |
||
61 | * @return Iterator |
||
62 | */ |
||
63 | 12 | private function parseIterator(Iterator $iterator) |
|
75 | |||
76 | /** |
||
77 | * @param Iterator $iterator |
||
78 | * |
||
79 | * @return Iterator |
||
80 | */ |
||
81 | 12 | private function parseHeaderRow(Iterator $iterator) |
|
89 | |||
90 | /** |
||
91 | * Parse the rows looking for the header row and storing it locally |
||
92 | * |
||
93 | * @param ArrayIterator $current |
||
94 | * @param int $key |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function handleHeaderRow(ArrayIterator $current, $key) |
||
108 | |||
109 | /** |
||
110 | * Map any headers found onto each element in the data |
||
111 | * |
||
112 | * @param ArrayIterator $current |
||
113 | * |
||
114 | * @return ArrayIterator |
||
115 | */ |
||
116 | public function mapHeaders(ArrayIterator $current) |
||
132 | } |
||
133 |
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: