src/Eloquent/Typhoon/Generator/ParameterListMerge/MergeTool.php
protected function mergeParameter(
        RuntimeConfiguration $configuration,
        ClassDefinition $classDefinition = null,
        MethodDefinition $methodDefinition,
        Parameter $documentedParameter,
        Parameter $nativeParameter
    ) {
        $this->typeCheck->mergeParameter(func_get_args());

        if ($documentedParameter->name() !== $nativeParameter->name()) {
            $this->handleError(new DocumentedParameterNameMismatch(
                $classDefinition,
                $methodDefinition,
                $nativeParameter->name(),
                $documentedParameter->name()
            ));

            return $nativeParameter;
        }

        if ($documentedParameter->isByReference() !== $nativeParameter->isByReference()) {
            $this->handleError(new DocumentedParameterByReferenceMismatch(
                $classDefinition,
                $methodDefinition,
                $nativeParameter->name(),
                $nativeParameter->isByReference()
            ));
        }

        return new Parameter(
            $documentedParameter->name(),
            $this->mergeType(
                $configuration,
                $classDefinition,
                $methodDefinition,
                $documentedParameter->name(),
                $documentedParameter->type(),
                $nativeParameter->type()
            ),
            $documentedParameter->description(),
            $nativeParameter->isOptional(),
            $documentedParameter->isByReference()
        );
    }
protected function mergeParameter(
        RuntimeConfiguration $configuration,
        ClassDefinition $classDefinition = null,
        MethodDefinition $methodDefinition,
        Parameter $documentedParameter,
        Parameter $nativeParameter
    ) {
        $this->typeCheck->mergeParameter(func_get_args());

        if ($documentedParameter->name() !== $nativeParameter->name()) {
            $this->handleError(new DocumentedParameterNameMismatch(
                $classDefinition,
                $methodDefinition,
                $nativeParameter->name(),
                $documentedParameter->name()
            ));

            return $nativeParameter;
        }

        if ($documentedParameter->isByReference() !== $nativeParameter->isByReference()) {
            $this->handleError(new DocumentedParameterByReferenceMismatch(
                $classDefinition,
                $methodDefinition,
                $nativeParameter->name(),
                $nativeParameter->isByReference()
            ));
        }

        return new Parameter(
            $documentedParameter->name(),
            $this->mergeType(
                $configuration,
                $classDefinition,
                $methodDefinition,
                $documentedParameter->name(),
                $documentedParameter->type(),
                $nativeParameter->type()
            ),
            $documentedParameter->description(),
            $nativeParameter->isOptional(),
            $documentedParameter->isByReference()
        );
    }
@param RuntimeConfiguration $configuration
@param ClassDefinition|null $classDefinition
@param MethodDefinition     $methodDefinition
@param Parameter            $documentedParameter
@param Parameter            $nativeParameter

@return Parameter