$item ) { $sorted[ $key ] = self::canonicalize( $item ); } return $sorted; } /** * Whether $value is a sequential-integer-keyed list (0, 1, 2, ... in * order), i.e. the PHP 8.1 `array_is_list()` check, reimplemented for * PHP 7.4 compatibility. * * @param array $value Candidate array. * @return bool */ private static function isList( array $value ): bool { $expected = 0; foreach ( $value as $key => $unused_value ) { if ( $key !== $expected ) { return false; } $expected++; } return true; } }