Version: 3.1
Bug Description
When $newKey exsits in $array and is positioned after $oldKey, Arrays::renameKey() preserves the value of $newKey over the value of $oldKey.
Steps To Reproduce
use Nette\Utils\Arrays;
$array = [ 0 => 0, 1 => 1 ];
$oldKey = 0;
$newKey = 1;
$renamedArray = [ $newKey => $array[ $oldKey ] ];
Arrays::renameKey( $array, $oldKey, $newKey );
var_dump( $array === $renamedArray ); // bool(false)
Expected Behavior
bool(true)
Possible Solution