-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathArrayyRewindableExtendedGenerator.php
More file actions
49 lines (43 loc) · 1 KB
/
ArrayyRewindableExtendedGenerator.php
File metadata and controls
49 lines (43 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
namespace Arrayy;
/**
* @template XKey of array-key
* @template X
* @extends ArrayyRewindableGenerator<XKey,X>
*
* @internal
*/
class ArrayyRewindableExtendedGenerator extends ArrayyRewindableGenerator
{
public function __construct(
callable $generatorConstructionFunction,
?callable $onRewind = null,
string $class = ''
) {
parent::__construct(
$generatorConstructionFunction,
$onRewind,
$class
);
}
/**
* Return the current element.
*
* @return mixed
*
* @see http://php.net/manual/en/iterator.current.php
* @see Iterator::current
*
* @phpstan-return X
*/
#[\ReturnTypeWillChange]
public function current()
{
$value = $this->generator->current();
if (\is_array($value)) {
$value = \call_user_func([$this->class, 'create'], $value, static::class, false);
}
return $value;
}
}