[2.0.0-beta5] Warning if "is iterable" test found

Created on 31 October 2024, 3 months ago

Problem/Motivation

Since Twig 3.11, there are 2 new tests: is sequence and is mapping.

UI Patterns 2. is supporting Drupal 10.3.4 and superior, so those tests are available:

There is no reason to use "is iterable" test in my opinion:

  • On a slot, "is iterable" will always return true. A render array is a iterable, a strign is an iterable, a list of renderable is a renderable
  • On a prop, we know the JSON data type of the variable: object for mapping, array for sequence

Proposed resolution

Detect is iterable test, raise this warning:

`is iterable` test is too ambiguous. Use `is sequence` or `is mapping`

✨ Feature request
Status

Active

Version

2.0

Component

UI Patterns Devel [2.x only]

Created by

πŸ‡«πŸ‡·France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024