Go to file
C. Scott Ananian 187de4b769 The ::querySelectorAll() and ::getElementsBy* helpers don't always return array
The standard type for these returns is NodeList and HTMLCollection, which
are almost *but not quite* the same as an array.  In two places we got a
little complacent and assumed our non-standard DOMCompat workarounds would
always return arrays.  Tweaked the types of DOMCompat to report that they
return an `iterable`, which is a PHP7.1 "pseudo-type" that unifies
arrays and \Traversable types like HTMLCollection/NodeList.  This
allows phan to catch places where we slip up and assume an array type
return.

It does introduce a new wrinkle, though, since there is no simple way
to turn an iterable into an array.  We're using a simple
`iterable_to_array` helper function for this.

Change-Id: I35bdeb3afa30ef5182e71733a0a606aadcafb435
2021-07-31 03:50:07 +00:00
src/Parsoid The ::querySelectorAll() and ::getElementsBy* helpers don't always return array 2021-07-31 03:50:07 +00:00