| @@ 5221-5232 (lines=12) @@ | ||
| 5218 | * @psalm-return static<TKey,T> |
|
| 5219 | * @psalm-mutation-free |
|
| 5220 | */ |
|
| 5221 | public function removeFirst(): self |
|
| 5222 | { |
|
| 5223 | $tmpArray = $this->toArray(); |
|
| 5224 | ||
| 5225 | \array_shift($tmpArray); |
|
| 5226 | ||
| 5227 | return static::create( |
|
| 5228 | $tmpArray, |
|
| 5229 | $this->iteratorClass, |
|
| 5230 | false |
|
| 5231 | ); |
|
| 5232 | } |
|
| 5233 | ||
| 5234 | /** |
|
| 5235 | * Remove the last value from the current array. |
|
| @@ 5247-5258 (lines=12) @@ | ||
| 5244 | * @psalm-return static<TKey,T> |
|
| 5245 | * @psalm-mutation-free |
|
| 5246 | */ |
|
| 5247 | public function removeLast(): self |
|
| 5248 | { |
|
| 5249 | $tmpArray = $this->toArray(); |
|
| 5250 | ||
| 5251 | \array_pop($tmpArray); |
|
| 5252 | ||
| 5253 | return static::create( |
|
| 5254 | $tmpArray, |
|
| 5255 | $this->iteratorClass, |
|
| 5256 | false |
|
| 5257 | ); |
|
| 5258 | } |
|
| 5259 | ||
| 5260 | /** |
|
| 5261 | * Removes a particular value from an array (numeric or associative). |
|
| @@ 5531-5540 (lines=10) @@ | ||
| 5528 | * @psalm-return static<TKey,T> |
|
| 5529 | * @psalm-mutation-free |
|
| 5530 | */ |
|
| 5531 | public function rest(int $from = 1): self |
|
| 5532 | { |
|
| 5533 | $tmpArray = $this->toArray(); |
|
| 5534 | ||
| 5535 | return static::create( |
|
| 5536 | \array_splice($tmpArray, $from), |
|
| 5537 | $this->iteratorClass, |
|
| 5538 | false |
|
| 5539 | ); |
|
| 5540 | } |
|
| 5541 | ||
| 5542 | /** |
|
| 5543 | * Return the array in the reverse order. |
|