Merging 2 Configurations in Laminas

Code
<?php

use Laminas\Config\Config;
use 
Laminas\Debug\Debug;

$array1 = [
    
'base' => [
        
'env' => 'prod',
        
'path' => '//config1',
        
'credentials' => [
            
'user' => 'johnDoe42',
            
'password' => 'hfvggjihdsc63vg',
        ],
        
'val1' => 'config1',
    ],
];

$array2 = [
    
'base' => [
        
'env' => 'dev',
        
'path' => '//config2',
        
'credentials' => [
            
'user' => 'janeDoe42',
            
'password' => 'abc123',
        ],
        
'val2' => 'config2',
    ],
];

$allowChanges true;
$config1 = new Config($array1$allowChanges);
$config2 = new Config($array2);

$config1->merge($config2);

dump($config1->toArray());
Result
^ array:1 [
"base" => array:5 [
"env" => "dev"
"path" => "//config2"
"credentials" => array:2 [
"user" => "janeDoe42"
"password" => "abc123"
]
"val1" => "config1"
"val2" => "config2"
]
]
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8