Skip to content

Commit ddf83ff

Browse files
committed
Simplify Dictionary::fromPairs
1 parent 5ca641c commit ddf83ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Dictionary.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public static function fromAssociative(iterable $members = []): self
6363
*/
6464
public static function fromPairs(Dictionary|iterable $pairs = []): self
6565
{
66-
$instance = new self();
6766
if ($pairs instanceof Dictionary) {
68-
$pairs = $pairs->toPairs();
67+
return clone $pairs;
6968
}
7069

70+
$instance = new self();
7171
foreach ($pairs as [$key, $member]) {
7272
$instance->set($key, $member);
7373
}

0 commit comments

Comments
 (0)