Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(saveObjects-error-msg): refine the error thrown by the method #584

Open
wants to merge 3 commits into
base: v3
Choose a base branch
from

Conversation

chloelbn
Copy link

@chloelbn chloelbn commented Sep 9, 2019

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #583
Need Doc update no

src/Exceptions/ArrayOfObjectsExpected.php Outdated Show resolved Hide resolved
src/SearchIndex.php Outdated Show resolved Hide resolved
src/Exceptions/InvalidArgumentObjectsException.php Outdated Show resolved Hide resolved
*/
public static function isIterable($object)
{
return is_array($object) || is_object($object) || $object instanceof \Traversable;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain me is_object($object)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to cover the maximum cases where a given variable is foreachable, and objects as arrays don't implement the Traversable interface. cf https://www.php.net/manual/en/class.traversable.php

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but objects are foreachable if they implement ArrayAccess interface. Correct? They ArrayAccess interface return true on is_array. No ?

nunomaduro
nunomaduro previously approved these changes Sep 10, 2019
@nunomaduro
Copy link

Putting this on hold, waiting for Chloe for this.

@Haroenv Haroenv removed the request for review from nunomaduro December 7, 2022 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine the error messages on saveObjects
3 participants