| @@ 5689-5701 (lines=13) @@ | ||
| 5686 | * @phpstan-return static<TKey,T> |
|
| 5687 | * @psalm-mutation-free |
|
| 5688 | */ |
|
| 5689 | public function replaceAllKeys(array $keys): self |
|
| 5690 | { |
|
| 5691 | $data = \array_combine($keys, $this->toArray()); |
|
| 5692 | if ($data === false) { |
|
| 5693 | $data = []; |
|
| 5694 | } |
|
| 5695 | ||
| 5696 | return static::create( |
|
| 5697 | $data, |
|
| 5698 | $this->iteratorClass, |
|
| 5699 | false |
|
| 5700 | ); |
|
| 5701 | } |
|
| 5702 | ||
| 5703 | /** |
|
| 5704 | * Create an array using the current array as keys and the other array as values. |
|
| @@ 5732-5744 (lines=13) @@ | ||
| 5729 | * @phpstan-return static<TKey,T> |
|
| 5730 | * @psalm-mutation-free |
|
| 5731 | */ |
|
| 5732 | public function replaceAllValues(array $array): self |
|
| 5733 | { |
|
| 5734 | $data = \array_combine($this->toArray(), $array); |
|
| 5735 | if ($data === false) { |
|
| 5736 | $data = []; |
|
| 5737 | } |
|
| 5738 | ||
| 5739 | return static::create( |
|
| 5740 | $data, |
|
| 5741 | $this->iteratorClass, |
|
| 5742 | false |
|
| 5743 | ); |
|
| 5744 | } |
|
| 5745 | ||
| 5746 | /** |
|
| 5747 | * Replace the keys in an array with another set. |
|
| @@ 5762-5775 (lines=14) @@ | ||
| 5759 | * @phpstan-return static<TKey,T> |
|
| 5760 | * @psalm-mutation-free |
|
| 5761 | */ |
|
| 5762 | public function replaceKeys(array $keys): self |
|
| 5763 | { |
|
| 5764 | $values = \array_values($this->toArray()); |
|
| 5765 | $result = \array_combine($keys, $values); |
|
| 5766 | if ($result === false) { |
|
| 5767 | $result = []; |
|
| 5768 | } |
|
| 5769 | ||
| 5770 | return static::create( |
|
| 5771 | $result, |
|
| 5772 | $this->iteratorClass, |
|
| 5773 | false |
|
| 5774 | ); |
|
| 5775 | } |
|
| 5776 | ||
| 5777 | /** |
|
| 5778 | * Replace the first matched value in an array. |
|