You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scalarizeArray method deals internally with values of type array OR objects with ArrayAccessible interface (see code). But when recursively called and an object with ArrayAccess occurs, it fails due to only array is allowed as type.
For example if you pass a doctrine ArrayCollection you get
[TypeError] Codeception\Module::scalarizeArray(): Argument #1 ($array) must be of type array, Doctrine\Common\Collections\ArrayCollection given, called in /var/www/html/vendor/codeception/codeception/src/Codeception/Module.php on line 317
as an error back.
Should the method signature be protected function scalarizeArray(ArrayAccess|array $array): ArrayAccess|array to be ready for both types? Otherwise your check(is_array($v) || $v instanceof ArrayAccess) does not make much sense.
This seems to be a problem from PHP 8.2 on.
Codeception version: 5.0.3
PHP Version: 8.2
Operating System: Linux
Installation type: Composer
List of installed packages (composer show)
The text was updated successfully, but these errors were encountered:
I think that scalarizeArray should be moved to REST module, because it is the only module that is using this method. scalarizeArray in Codeception\Module can be marked as @deprecated to avoid breaking some 3rd party module in patch release.
The
scalarizeArray
method deals internally with values of typearray
OR objects withArrayAccessible
interface (see code). But when recursively called and an object withArrayAccess
occurs, it fails due to onlyarray
is allowed as type.For example if you pass a doctrine ArrayCollection you get
as an error back.
Should the method signature be
protected function scalarizeArray(ArrayAccess|array $array): ArrayAccess|array
to be ready for both types? Otherwise your check(is_array($v) || $v instanceof ArrayAccess)
does not make much sense.This seems to be a problem from PHP 8.2 on.
composer show
)The text was updated successfully, but these errors were encountered: