| @@ 5658-5670 (lines=13) @@ | ||
| 5655 | * @phpstan-return static<TKey,T> |
|
| 5656 | * @psalm-mutation-free |
|
| 5657 | */ |
|
| 5658 | public function replaceAllKeys(array $keys): self |
|
| 5659 | { |
|
| 5660 | $data = \array_combine($keys, $this->toArray()); |
|
| 5661 | if ($data === false) { |
|
| 5662 | $data = []; |
|
| 5663 | } |
|
| 5664 | ||
| 5665 | return static::create( |
|
| 5666 | $data, |
|
| 5667 | $this->iteratorClass, |
|
| 5668 | false |
|
| 5669 | ); |
|
| 5670 | } |
|
| 5671 | ||
| 5672 | /** |
|
| 5673 | * Create an array using the current array as keys and the other array as values. |
|
| @@ 5701-5713 (lines=13) @@ | ||
| 5698 | * @phpstan-return static<TKey,T> |
|
| 5699 | * @psalm-mutation-free |
|
| 5700 | */ |
|
| 5701 | public function replaceAllValues(array $array): self |
|
| 5702 | { |
|
| 5703 | $data = \array_combine($this->toArray(), $array); |
|
| 5704 | if ($data === false) { |
|
| 5705 | $data = []; |
|
| 5706 | } |
|
| 5707 | ||
| 5708 | return static::create( |
|
| 5709 | $data, |
|
| 5710 | $this->iteratorClass, |
|
| 5711 | false |
|
| 5712 | ); |
|
| 5713 | } |
|
| 5714 | ||
| 5715 | /** |
|
| 5716 | * Replace the keys in an array with another set. |
|
| @@ 5731-5744 (lines=14) @@ | ||
| 5728 | * @phpstan-return static<TKey,T> |
|
| 5729 | * @psalm-mutation-free |
|
| 5730 | */ |
|
| 5731 | public function replaceKeys(array $keys): self |
|
| 5732 | { |
|
| 5733 | $values = \array_values($this->toArray()); |
|
| 5734 | $result = \array_combine($keys, $values); |
|
| 5735 | if ($result === false) { |
|
| 5736 | $result = []; |
|
| 5737 | } |
|
| 5738 | ||
| 5739 | return static::create( |
|
| 5740 | $result, |
|
| 5741 | $this->iteratorClass, |
|
| 5742 | false |
|
| 5743 | ); |
|
| 5744 | } |
|
| 5745 | ||
| 5746 | /** |
|
| 5747 | * Replace the first matched value in an array. |
|