public static function mergeScalarSafe(array &$first, array &$second)
    {
        $merged = $first;

        foreach ($second as $key => &$value) {
            if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
                $merged[$key] = self::mergeScalarSafe($merged[$key], $value);
            } else {
                $merged[$key] = $value;
            }
        }

        return $merged;
    }