for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ahc\Phint\Util;
class Arr
{
/**
* @see http://php.net/array_merge_recursive#92195
*
* @param array $array1
* @param array $array2
* @return array
*/
public function mergeRecursive(array $array1, array $array2)
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (\is_array($value) && isset($merged[$key]) && \is_array($merged[$key])) {
$merged[$key] = self::mergeRecursive($merged[$key], $value);
Ahc\Phint\Util\Arr::mergeRecursive()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
/** @scrutinizer ignore-call */
} else {
$merged[$key] = $value;
}
return $merged;