public function resolve(
        Parameter $parameter,
        ParameterBag $unresolvedParameters,
        ParameterBag $resolvedParameters,
        ResolvingContext $context = null,
        ParameterBag $previousResult = null,
        int $counter = 1
    ): ParameterBag {
        if (null === $previousResult) {
            $result = $this->resolver->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context);

            return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result);
        }

        $parameterKey = $parameter->getKey();
        $previousParameterValue = $previousResult->get($parameterKey);
        $counter = $this->incrementCounter($counter, $this->limit, $parameterKey);

        $newResult = $this->resolver->resolve(
            $parameter->withValue($previousParameterValue),
            $unresolvedParameters,
            $resolvedParameters,
            $context
        );
        $newParameterValue = $newResult->get($parameterKey);
        $result = $this->mergeResults($previousResult, $newResult);

        if ($previousParameterValue === $newParameterValue) {
            return $result;
        }

        return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result, $counter);
    }
public function resolve(
        Parameter $parameter,
        ParameterBag $unresolvedParameters,
        ParameterBag $resolvedParameters,
        ResolvingContext $context = null,
        ParameterBag $previousResult = null,
        int $counter = 1
    ): ParameterBag {
        if (null === $previousResult) {
            $result = $this->resolver->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context);

            return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result);
        }

        $parameterKey = $parameter->getKey();
        $previousParameterValue = $previousResult->get($parameterKey);
        $counter = $this->incrementCounter($counter, $this->limit, $parameterKey);

        $newResult = $this->resolver->resolve(
            $parameter->withValue($previousParameterValue),
            $unresolvedParameters,
            $resolvedParameters,
            $context
        );
        $newParameterValue = $newResult->get($parameterKey);
        $result = $this->mergeResults($previousResult, $newResult);

        if ($previousParameterValue === $newParameterValue) {
            return $result;
        }

        return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result, $counter);
    }
public function resolve ( Parameter $ parameter , ParameterBag $ unresolvedParameters , ParameterBag $ resolvedParameters , ResolvingContext $ context = null , ParameterBag $ previousResult = null , int $ counter = 1 ) : ParameterBag { if ( null === $ previousResult ) { $ result = $ this -> resolver -> resolve ( $ parameter , $ unresolvedParameters , $ resolvedParameters , $ context ) ; return $ this -> resolve ( $ parameter , $ unresolvedParameters , $ resolvedParameters , $ context , $ result ) ; } $ parameterKey = $ parameter -> getKey ( ) ; $ previousParameterValue = $ previousResult -> get ( $ parameterKey ) ; $ counter = $ this -> incrementCounter ( $ counter , $ this -> limit , $ parameterKey ) ; $ newResult = $ this -> resolver -> resolve ( $ parameter -> withValue ( $ previousParameterValue ) , $ unresolvedParameters , $ resolvedParameters , $ context ) ; $ newParameterValue = $ newResult -> get ( $ parameterKey ) ; $ result = $ this -> mergeResults ( $ previousResult , $ newResult ) ; if ( $ previousParameterValue === $ newParameterValue ) { return $ result ; } return $ this -> resolve ( $ parameter , $ unresolvedParameters , $ resolvedParameters , $ context , $ result , $ counter ) ; }
Resolves a parameter two times and if a different result is obtained will resolve the parameter again until two
successive resolution give the same result.

{@inheritdoc}

@throws RecursionLimitReachedException
Resolves a parameter two times and if a different result is obtained will resolve the parameter again until two successive resolution give the same result .