| @@ 2096-2106 (lines=11) @@ | ||
| 2093 | * @psalm-return static<TKey,T> |
|
| 2094 | * @psalm-mutation-free |
|
| 2095 | */ |
|
| 2096 | public function each(\Closure $closure): self |
|
| 2097 | { |
|
| 2098 | // init |
|
| 2099 | $array = []; |
|
| 2100 | ||
| 2101 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2102 | $array[$key] = $closure($value, $key); |
|
| 2103 | } |
|
| 2104 | ||
| 2105 | return static::create( |
|
| 2106 | $array, |
|
| 2107 | $this->iteratorClass, |
|
| 2108 | false |
|
| 2109 | ); |
|
| @@ 4738-4749 (lines=12) @@ | ||
| 4735 | * @psalm-return static<TKey,T> |
|
| 4736 | * @psalm-mutation-free |
|
| 4737 | */ |
|
| 4738 | public function reject(\Closure $closure): self |
|
| 4739 | { |
|
| 4740 | // init |
|
| 4741 | $filtered = []; |
|
| 4742 | ||
| 4743 | foreach ($this->getGenerator() as $key => $value) { |
|
| 4744 | if (!$closure($value, $key)) { |
|
| 4745 | $filtered[$key] = $value; |
|
| 4746 | } |
|
| 4747 | } |
|
| 4748 | ||
| 4749 | return static::create( |
|
| 4750 | $filtered, |
|
| 4751 | $this->iteratorClass, |
|
| 4752 | false |
|