Skip to content

Commit c9508bc

Browse files
committed
Fixed key/value mapping in rekey()
1 parent 64cb8bb commit c9508bc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Map.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4013,10 +4013,9 @@ public function reject( $callback = true ) : self
40134013
public function rekey( callable $callback ) : self
40144014
{
40154015
$list = $this->list();
4016-
$keys = array_keys( $list );
4017-
$newKeys = array_map( $callback, $list, $keys );
4016+
$newKeys = array_map( $callback, $list, array_keys( $list ) );
40184017

4019-
return new static( array_combine( $newKeys, $list ) ?: [] );
4018+
return new static( array_combine( $newKeys, array_values( $list ) ) );
40204019
}
40214020

40224021

0 commit comments

Comments
 (0)