original_string: public function merge(JsonSchema $left, JsonSchema $right)
      {
          $merged = clone $right;
  
          if ($left->getType() !== null && $right->getType() !== null && $left->getType() !== $right->getType()) {
              throw new \RuntimeException("Both types are defined and different, merge is not possible");
          }
  
          if ($right->getType() === null && $left->getType() !== null) {
              $merged->setType($left->getType());
          }
  
          $merged->setProperties($this->arrayMerge($left->getProperties(), $right->getProperties()));
          $merged->setRequired($this->arrayUnique($this->arrayMerge($left->getRequired(), $right->getRequired())));
  
          return $merged;
      }
code: public function merge(JsonSchema $left, JsonSchema $right)
      {
          $merged = clone $right;
  
          if ($left->getType() !== null && $right->getType() !== null && $left->getType() !== $right->getType()) {
              throw new \RuntimeException("Both types are defined and different, merge is not possible");
          }
  
          if ($right->getType() === null && $left->getType() !== null) {
              $merged->setType($left->getType());
          }
  
          $merged->setProperties($this->arrayMerge($left->getProperties(), $right->getProperties()));
          $merged->setRequired($this->arrayUnique($this->arrayMerge($left->getRequired(), $right->getRequired())));
  
          return $merged;
      }
code_tokens: public function merge ( JsonSchema $ left , JsonSchema $ right ) { $ merged = clone $ right ; if ( $ left -> getType ( ) !== null && $ right -> getType ( ) !== null && $ left -> getType ( ) !== $ right -> getType ( ) ) { throw new \ RuntimeException ( "Both types are defined and different, merge is not possible" ) ; } if ( $ right -> getType ( ) === null && $ left -> getType ( ) !== null ) { $ merged -> setType ( $ left -> getType ( ) ) ; } $ merged -> setProperties ( $ this -> arrayMerge ( $ left -> getProperties ( ) , $ right -> getProperties ( ) ) ) ; $ merged -> setRequired ( $ this -> arrayUnique ( $ this -> arrayMerge ( $ left -> getRequired ( ) , $ right -> getRequired ( ) ) ) ) ; return $ merged ; }
docstring: Create a new JsonSchema based on two merged schema
  
  @param JsonSchema $left
  @param JsonSchema $right
  
  @TODO Handle more fields
  
  @return JsonSchema
docstring_tokens: Create a new JsonSchema based on two merged schema