Problem/Motivation

There are a number of places in core that call is_array followed by instanceof Traversable or instanceof Countable. These can be replaced by is_iterable since PHP 7.1 and is_countable since PHP 7.3.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3422543

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Doing searches for $value instanceof \Traversable and instanceof \Countable; and checking if they're also checking is_array, believe all have been addressed.

Left a comment but I would +1 for deprecating that one function since it does 1 thing now.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Added some suggestions to the MR.

mstrelan’s picture

Status: Needs work » Needs review

Deprecated Inspector::assertTraversable and added a change record. Applied both suggestions.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Left some comments on MR about the CR link.

But checked that the replacements were done. Probably good to self RTBC @mstrelan after the link updates.

mstrelan’s picture

Status: Needs work » Reviewed & tested by the community

Fixed the link to the CR, back to RTBC

alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed c506000f20 to 11.x and 8b6fd70a73 to 10.3.x. Thanks!

  • alexpott committed 8b6fd70a on 10.3.x
    Issue #3422543 by mstrelan, smustgrave, longwave: Make use of...

  • alexpott committed c506000f on 11.x
    Issue #3422543 by mstrelan, smustgrave, longwave: Make use of...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.