Skip to content

Commit b45e2cf

Browse files
yottalogicalisfedorov
authored andcommitted
Add type generics to iterator_to_array
1 parent 991fd13 commit b45e2cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

SPL/SPL_f.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,15 @@ function spl_object_hash(object $object): string {}
139139
/**
140140
* Copy the iterator into an array
141141
* @link https://php.net/manual/en/function.iterator-to-array.php
142-
* @param Traversable $iterator <p>
142+
* @template TKey
143+
* @template TValue
144+
* @param Traversable<TKey, TValue> $iterator <p>
143145
* The iterator being copied.
144146
* </p>
145147
* @param bool $preserve_keys [optional] <p>
146148
* Whether to use the iterator element keys as index.
147149
* </p>
148-
* @return array An array containing the elements of the iterator.
150+
* @return array<TKey, TValue>|TValue[] An array containing the elements of the iterator.
149151
*/
150152
function iterator_to_array(#[LanguageLevelTypeAware(['8.2' => 'Traversable|array'], default: 'Traversable')] $iterator, bool $preserve_keys = true): array {}
151153

0 commit comments

Comments
 (0)