code: private function arrayMergeDeep(array $array1, array $array2) : array
      {
          $merged = $array1;
  
          foreach ($array2 as $key => & $value) {
              if (is_numeric($key)) {
                  if (! in_array($value, $merged, true)) {
                      $merged[] = $value;
                  }
              } elseif (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
                  $merged[$key] = $this->arrayMergeDeep($merged[$key], $value);
              } else {
                  $merged[$key] = $value;
              }
          }
  
          return $merged;
      }
docs: similar to array_merge_recursive this merges nested arrays, but handles non array values differently
  while array_merge_recursive tries to merge non array values, in this implementation they will be overwritten
  
  @see https://stackoverflow.com/a/25712428
  
  @param mixed[] $array1
  @param mixed[] $array2
  
  @return mixed[]