| @@ 3481-3494 (lines=14) @@ | ||
| 3478 | * @psalm-return static<int|TKey,T> |
|
| 3479 | * @psalm-mutation-free |
|
| 3480 | */ |
|
| 3481 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
| 3482 | { |
|
| 3483 | if ($recursive === true) { |
|
| 3484 | $result = \array_replace_recursive($this->toArray(), $array); |
|
| 3485 | } else { |
|
| 3486 | $result = \array_replace($this->toArray(), $array); |
|
| 3487 | } |
|
| 3488 | ||
| 3489 | return static::create( |
|
| 3490 | $result, |
|
| 3491 | $this->iteratorClass, |
|
| 3492 | false |
|
| 3493 | ); |
|
| 3494 | } |
|
| 3495 | ||
| 3496 | /** |
|
| 3497 | * Merge the new $array into the current array. |
|
| @@ 3512-3525 (lines=14) @@ | ||
| 3509 | * @psalm-return static<TKey,T> |
|
| 3510 | * @psalm-mutation-free |
|
| 3511 | */ |
|
| 3512 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
| 3513 | { |
|
| 3514 | if ($recursive === true) { |
|
| 3515 | $result = \array_merge_recursive($this->toArray(), $array); |
|
| 3516 | } else { |
|
| 3517 | $result = \array_merge($this->toArray(), $array); |
|
| 3518 | } |
|
| 3519 | ||
| 3520 | return static::create( |
|
| 3521 | $result, |
|
| 3522 | $this->iteratorClass, |
|
| 3523 | false |
|
| 3524 | ); |
|
| 3525 | } |
|
| 3526 | ||
| 3527 | /** |
|
| 3528 | * Merge the the current array into the $array. |
|
| @@ 3542-3555 (lines=14) @@ | ||
| 3539 | * @psalm-return static<TKey,T> |
|
| 3540 | * @psalm-mutation-free |
|
| 3541 | */ |
|
| 3542 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
| 3543 | { |
|
| 3544 | if ($recursive === true) { |
|
| 3545 | $result = \array_replace_recursive($array, $this->toArray()); |
|
| 3546 | } else { |
|
| 3547 | $result = \array_replace($array, $this->toArray()); |
|
| 3548 | } |
|
| 3549 | ||
| 3550 | return static::create( |
|
| 3551 | $result, |
|
| 3552 | $this->iteratorClass, |
|
| 3553 | false |
|
| 3554 | ); |
|
| 3555 | } |
|
| 3556 | ||
| 3557 | /** |
|
| 3558 | * Merge the current array into the new $array. |
|
| @@ 3573-3586 (lines=14) @@ | ||
| 3570 | * @psalm-return static<TKey,T> |
|
| 3571 | * @psalm-mutation-free |
|
| 3572 | */ |
|
| 3573 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
| 3574 | { |
|
| 3575 | if ($recursive === true) { |
|
| 3576 | $result = \array_merge_recursive($array, $this->toArray()); |
|
| 3577 | } else { |
|
| 3578 | $result = \array_merge($array, $this->toArray()); |
|
| 3579 | } |
|
| 3580 | ||
| 3581 | return static::create( |
|
| 3582 | $result, |
|
| 3583 | $this->iteratorClass, |
|
| 3584 | false |
|
| 3585 | ); |
|
| 3586 | } |
|
| 3587 | ||
| 3588 | /** |
|
| 3589 | * @return ArrayyMeta|static |
|