protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null)
    {
        $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context);

        $returnType = null;
        if ($object->getReturnType() !== null) {
            $typeResolver = new TypeResolver();
            if ($object->getReturnType() instanceof NullableType) {
                $typeString = '?' . $object->getReturnType()->type;
            } else {
                $typeString = (string) $object->getReturnType();
            }

            $returnType = $typeResolver->resolve($typeString, $context);
        }

        $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine()), $returnType);

        foreach ($object->params as $param) {
            $strategy = $strategies->findMatching($param);
            $function->addArgument($strategy->create($param, $strategies, $context));
        }

        return $function;
    }
protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null)
    {
        $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context);

        $returnType = null;
        if ($object->getReturnType() !== null) {
            $typeResolver = new TypeResolver();
            if ($object->getReturnType() instanceof NullableType) {
                $typeString = '?' . $object->getReturnType()->type;
            } else {
                $typeString = (string) $object->getReturnType();
            }

            $returnType = $typeResolver->resolve($typeString, $context);
        }

        $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine()), $returnType);

        foreach ($object->params as $param) {
            $strategy = $strategies->findMatching($param);
            $function->addArgument($strategy->create($param, $strategies, $context));
        }

        return $function;
    }
protected function doCreate ( $ object , StrategyContainer $ strategies , ? Context $ context = null ) { $ docBlock = $ this -> createDocBlock ( $ strategies , $ object -> getDocComment ( ) , $ context ) ; $ returnType = null ; if ( $ object -> getReturnType ( ) !== null ) { $ typeResolver = new TypeResolver ( ) ; if ( $ object -> getReturnType ( ) instanceof NullableType ) { $ typeString = '?' . $ object -> getReturnType ( ) -> type ; } else { $ typeString = ( string ) $ object -> getReturnType ( ) ; } $ returnType = $ typeResolver -> resolve ( $ typeString , $ context ) ; } $ function = new FunctionDescriptor ( $ object -> fqsen , $ docBlock , new Location ( $ object -> getLine ( ) ) , $ returnType ) ; foreach ( $ object -> params as $ param ) { $ strategy = $ strategies -> findMatching ( $ param ) ; $ function -> addArgument ( $ strategy -> create ( $ param , $ strategies , $ context ) ) ; } return $ function ; }
Creates an FunctionDescriptor out of the given object including its child elements.

@param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element
@param StrategyContainer $strategies used to convert nested objects.
@param Context $context of the created object
@return FunctionDescriptor
Creates an FunctionDescriptor out of the given object including its child elements .