Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Add dedicated RowIteratorInterface and SheetIteratorInterface #839

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jmleroux
Copy link

@jmleroux jmleroux commented Nov 10, 2021

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

@CLAassistant
Copy link

CLAassistant commented Nov 10, 2021

CLA assistant check
All committers have signed the CLA.

@jmleroux jmleroux marked this pull request as ready for review November 12, 2021 13:45
@Slamdunk
Copy link

Slamdunk commented Mar 2, 2022

Merged in openspout/openspout#7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants