spout icon indicating copy to clipboard operation
spout copied to clipboard

Add dedicated RowIteratorInterface and SheetIteratorInterface

Open jmleroux opened this issue 4 years ago • 2 comments

Dedicated interfaces are needed for correct type-hinting.

When using PHP >= 7.4, a more strict interface would for example allow safe use of Row::toArray() when using the iterator. If we keep the generic Iterator interface, the returned item is mixed type and the use of $item->toArray() is not safe.

We use the iterator in Akeneo here: https://github.com/akeneo/pim-community-dev/blob/master/src/Akeneo/Tool/Component/Connector/Reader/File/FlatFileIterator.php

Because of poor type hinting, we have to make a test on the instance, which could be avoided with better type hinting: https://github.com/akeneo/pim-community-dev/pull/14869/files#L96

jmleroux avatar Nov 10 '21 19:11 jmleroux

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 10 '21 19:11 CLAassistant

Merged in https://github.com/openspout/openspout/pull/7

Slamdunk avatar Mar 02 '22 12:03 Slamdunk