| @@ 2006-2016 (lines=11) @@ | ||
| 2003 | * @psalm-return static<TKey,T> | |
| 2004 | * @psalm-mutation-free | |
| 2005 | */ | |
| 2006 | public function each(\Closure $closure): self | |
| 2007 |     { | |
| 2008 | // init | |
| 2009 | $array = []; | |
| 2010 | ||
| 2011 |         foreach ($this->getGenerator() as $key => $value) { | |
| 2012 | $array[$key] = $closure($value, $key); | |
| 2013 | } | |
| 2014 | ||
| 2015 | return static::create( | |
| 2016 | $array, | |
| 2017 | $this->iteratorClass, | |
| 2018 | false | |
| 2019 | ); | |
| @@ 4547-4558 (lines=12) @@ | ||
| 4544 | * @psalm-return static<TKey,T> | |
| 4545 | * @psalm-mutation-free | |
| 4546 | */ | |
| 4547 | public function reject(\Closure $closure): self | |
| 4548 |     { | |
| 4549 | // init | |
| 4550 | $filtered = []; | |
| 4551 | ||
| 4552 |         foreach ($this->getGenerator() as $key => $value) { | |
| 4553 |             if (!$closure($value, $key)) { | |
| 4554 | $filtered[$key] = $value; | |
| 4555 | } | |
| 4556 | } | |
| 4557 | ||
| 4558 | return static::create( | |
| 4559 | $filtered, | |
| 4560 | $this->iteratorClass, | |
| 4561 | false | |