diff --git a/src/Framework/Constraint/Traversable/ArrayIsList.php b/src/Framework/Constraint/Traversable/ArrayIsList.php index 8e481067702..752328d7f1d 100644 --- a/src/Framework/Constraint/Traversable/ArrayIsList.php +++ b/src/Framework/Constraint/Traversable/ArrayIsList.php @@ -9,6 +9,7 @@ */ namespace PHPUnit\Framework\Constraint; +use function array_is_list; use function is_array; /** @@ -34,6 +35,11 @@ protected function matches(mixed $other): bool return false; } + if (function_exists('array_is_list')) { + return array_is_list($other); + } + + // @todo Remove this code once we require PHP >= 8.1 if ($other === []) { return true; }