@inheritDoc

@psalm-suppress InvalidReturnType Returning an object here is required
for creating a valid Apigee Edge request.
763814
public function normalize($object, $format = null, array $context = [])
    {
        /** @var object $normalized */
        $normalized = parent::normalize($object, $format, $context);
        $normalized->developer->isCompany = true;

        return $normalized;
    }
403812
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope) : Type {
        $returnType = $methodReflection->getReturnType();
        $origReturnDescribe = $returnType->describe();
        $error = false;

        if ($returnType instanceof UnionType && $origReturnDescribe=='object|string') {
            if (($args = $methodCall->args) && sizeof($args) > 1) {
                if (($definition = $args[1]->value) instanceof New_) {
                    if (($type = $definition->class) instanceof FullyQualified) {
                        $returnType = new ObjectType($type->toString());
                    } else $error = true(echoPre('(1) '.simpleClassName(static::$className).'->'.$methodCall->name.'() encountered non FullyQualified service definition: '.get_class($class)));
                } else     $error = true(echoPre('(2) '.simpleClassName(static::$className).'->'.$methodCall->name.'() encountered unexpected service definition type: '.get_class($definition)));
            }
        } else             $error = true(echoPre('(3) '.simpleClassName(static::$className).'->'.$methodCall->name.'() encountered unexpected return type: '.get_class($returnType).' => '.$returnType->describe()));

        $returnDescribe = $returnType->describe();

        if (0 || $error) echoPre('call of: '.simpleClassName(static::$className).'->'.$methodCall->name.'()  in: '.$this->getScopeDescription($scope).'  shall return: '.$returnDescribe.($returnDescribe==$origReturnDescribe ? ' (pass through)' : ' (was '.$origReturnDescribe.')'));
        return $returnType;
    }
1115804
public static void doReturn(MethodVisitor mv, ClassNode returnType) {
        if (returnType == ClassHelper.double_TYPE) {
            mv.visitInsn(DRETURN);
        } else if (returnType == ClassHelper.float_TYPE) {
            mv.visitInsn(FRETURN);
        } else if (returnType == ClassHelper.long_TYPE) {
            mv.visitInsn(LRETURN);
        } else if (
                returnType == ClassHelper.boolean_TYPE
                        || returnType == ClassHelper.char_TYPE
                        || returnType == ClassHelper.byte_TYPE
                        || returnType == ClassHelper.int_TYPE
                        || returnType == ClassHelper.short_TYPE) {
            //byte,short,boolean,int are all IRETURN
            mv.visitInsn(IRETURN);
        } else if (returnType == ClassHelper.VOID_TYPE) {
            mv.visitInsn(RETURN);
        } else {
            mv.visitInsn(ARETURN);
        }

    }
124566
function resendAuthCode($validationHash, $identifierType)
    {
        $response = $this->call( new Command\Recover\ResendCode($validationHash, $identifierType) );
        if ( $ex = $response->hasException() )
            throw $ex;

        $r = $response->expected();
        $r = ($r instanceof iDataEntity) ? $r->get('result') : $r;
        return $r;
    }
323437
protected function completeObjectValue(
        ObjectType $returnType,
        array $fieldNodes,
        ResolveInfo $info,
        array $path,
        &$result
    ) {
        // If there is an isTypeOfCallback predicate function, call it with the
        // current result. If isTypeOfCallback returns false, then raise an error rather
        // than continuing execution.
        if ($returnType->hasIsTypeOfCallback()) {
            $isTypeOf = $returnType->isTypeOf($result, $this->context->getContextValue(), $info);

            if ($isTypeOf instanceof PromiseInterface) {
                return $isTypeOf->then(function ($resolvedIsTypeOf) use ($returnType, $result, $fieldNodes, $path) {
                    if (true === $resolvedIsTypeOf) {
                        return $this->executeSubFields($returnType, $fieldNodes, $path, $result);
                    }

                    throw new InvalidReturnTypeException($returnType, $result, $fieldNodes);
                });
            }

            if (false === $isTypeOf) {
                throw new InvalidReturnTypeException($returnType, $result, $fieldNodes);
            }
        }

        return $this->executeSubFields($returnType, $fieldNodes, $path, $result);
    }
209974
void expectValidAsyncReturnType(Node n, JSType type) {
    if (promiseOfUnknownType.isSubtypeOf(type)) {
      return;
    }

    JSError err = JSError.make(n, INVALID_ASYNC_RETURN_TYPE, type.toString());
    registerMismatch(type, promiseOfUnknownType, err);
    report(err);
  }
1277259
function validateReturn (ret, methodMeta) {
    // do not validate if no schema
    if (!defined(methodMeta.schema.return)) {
        return ret
    }
    // do not validate if disabled
    if (!methodMeta.validateReturn) {
        return ret
    }
    // get validator
    var ajv = methodMeta.ajv
    // throw error if validation fails
    if (!ajv.validate(methodMeta.schema.return.id, ret)) {
        // create error
        var error = new Error(`${methodMeta.signature}: invalid return - ${ajv.errorsText()}`)
        // add ajv errors to error data
        error.data = ajv.errors
        // throw error
        throw error
    }
    // return possibly modified result
    return ret
}
1003989
public String getReturnType(HashMap<String,TypeMirror> bindingMap)
    {
        if ( _methodDecl == null || _methodDecl.getReturnType() == null )
            return "";
        
        String returnType = _methodDecl.getReturnType().toString();
        if (bindingMap != null && bindingMap.containsKey(returnType))
            return bindingMap.get(returnType).toString();

        return returnType;
    }
1243964
public void setReturnObject(PrintWriter out, Object objReturn)
    {
        String strReturn = org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertObjectToString(objReturn);
        strReturn = Base64.encode(strReturn);
        this.setReturnString(out, strReturn);
    }
318059
public function normalize($object, $format = null, array $context = [])
    {
        if (isset($context['api_sub_level'])) {
            return $this->normalizeRawCollection($object, $format, $context);
        }

        try {
            $resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null, true);
        } catch (InvalidArgumentException $e) {
            if (!isset($context['resource_class'])) {
                return $this->normalizeRawCollection($object, $format, $context);
            }

            throw $e;
        }
        $data = [];
        $context = $this->initContext($resourceClass, $context);

        return array_merge_recursive(
            $data,
            $this->getPaginationData($object, $context),
            $this->getItemsData($object, $format, $context)
        );
    }
206632
public function GetReturnType( $dataPool )
	{
		if ( $this->_func->ResultType == XPath2ResultType::Any && $this->getCount() > 0 )
		{
			/**
			 * @var XPath2ResultType $resType
			 */
			$resType = $this->getAbstractNode(0)->GetItemType( $dataPool );
			if ( $resType == XPath2ResultType::NodeSet )
				return XPath2ResultType::Any;
			return $resType;
		}
		return $this->_func->ResultType;
	}
922033
public function normalize($object, $format = null, array $context = [])
    {
        $normalized = (array) parent::normalize($object, $format, $context);

        // Do not send redundant API product information to Apigee Edge, the
        // id of a referenced API product is enough.
        foreach ($normalized['product'] as $id => $data) {
            $normalized['product'][$id] = (object) ['id' => $data->id];
        }

        return (object) $normalized;
    }
641664
public function createObjectType() : ObjectConstructorCallbackDefiner
    {
        return new ObjectConstructorCallbackDefiner($this->class, function (callable $typeCallback) {
            $this->createObjectCallback = function (array $input) use ($typeCallback) {
                $className = $this->class->getClassName();

                /** @var TypedObject|string $instanceOrType */
                $instanceOrType = $typeCallback($input);

                if (is_string($instanceOrType)) {
                    if (class_exists($instanceOrType) && is_a($instanceOrType, $className, true)) {
                        $instanceOrType = $instanceOrType::definition()->newCleanInstance();
                    }
                }

                if (!($instanceOrType instanceof $className)) {
                    throw InvalidReturnValueException::format(
                        'Invalid create object callback return value: expecting class compatible with %s, %s given',
                        $className, is_string($instanceOrType) ? $instanceOrType : Debug::getType($instanceOrType)
                    );
                }

                return $instanceOrType;
            };
        });
    }
663210
@Override
  public Description matchReturn(ReturnTree returnTree, VisitorState state) {
    ExpressionTree returnExpression = returnTree.getExpression();
    if (returnExpression == null || returnExpression.getKind() != Kind.NULL_LITERAL) {
      return Description.NO_MATCH;
    }

    TreePath path = state.getPath();
    MethodTree enclosingMethod = null;
    while (true) {
      if (path == null || path.getLeaf() instanceof LambdaExpressionTree) {
        return Description.NO_MATCH;
      } else if (path.getLeaf() instanceof MethodTree) {
        enclosingMethod = (MethodTree) path.getLeaf();
        break;
      } else {
        path = path.getParentPath();
      }
    }
    MethodSymbol enclosingMethodSym = ASTHelpers.getSymbol(enclosingMethod);
    if (enclosingMethodSym == null) {
      return Description.NO_MATCH;
    }

    if (!ASTHelpers.hasAnnotation(enclosingMethodSym, "dagger.Provides", state)
        || ASTHelpers.hasDirectAnnotationWithSimpleName(enclosingMethodSym, "Nullable")) {
      return Description.NO_MATCH;
    }

    Fix addNullableFix =
        SuggestedFix.builder()
            .prefixWith(enclosingMethod, "@Nullable\n")
            .addImport("javax.annotation.Nullable")
            .build();

    CatchTree enclosingCatch = ASTHelpers.findEnclosingNode(state.getPath(), CatchTree.class);
    if (enclosingCatch == null) {
      // If not in a catch block, suggest adding @Nullable first, then throwing an exception.
      Fix throwRuntimeExceptionFix =
          SuggestedFix.replace(returnTree, "throw new RuntimeException();");
      return buildDescription(returnTree)
          .addFix(addNullableFix)
          .addFix(throwRuntimeExceptionFix)
          .build();
    } else {
      // If in a catch block, suggest throwing an exception first, then adding @Nullable.
      String replacement =
          String.format("throw new RuntimeException(%s);", enclosingCatch.getParameter().getName());
      Fix throwRuntimeExceptionFix = SuggestedFix.replace(returnTree, replacement);
      return buildDescription(returnTree)
          .addFix(throwRuntimeExceptionFix)
          .addFix(addNullableFix)
          .build();
    }
  }
317813
private function parseAfterReturning($method, $args, &$returnValue)
    {
        $this->doAspect($method, 'afterReturning', function($aspectClassName, $methodName) use($method, $args, &$returnValue){
            $joinPoint = new AfterReturningJoinPoint('afterReturning', $method, $args, $this->object, $this);
            $joinPoint->setReturnValue($returnValue);
            call_user_func([new $aspectClassName, $methodName], $joinPoint);
            $returnValue = $joinPoint->getReturnValue();
        });
    }
1174089
private Context translateReturn(WyilFile.Stmt.Return stmt, Context context) {
		//
		Tuple<WyilFile.Expr> returns = stmt.getReturns();
		//
		if (returns.size() > 0) {
			// There is at least one return value. Therefore, we need to check
			// any preconditions for those return expressions and, potentially,
			// ensure any postconditions of the cnlosing function/method are
			// met.
			Pair<Expr[], Context> p = translateExpressionsWithChecks(returns, context);
			Expr[] exprs = p.first();
			context = p.second();
			//
			generateReturnTypeInvariantCheck(stmt, exprs, context);
			generatePostconditionChecks(stmt, exprs, context);
		}
		// Return null to signal that execution does not continue after this
		// return statement.
		return null;
	}
484812
protected JvmTypeReference inferFunctionReturnType(XtendFunction source, JvmOperation target, JvmOperation overriddenOperation) {
		// The return type is explicitly given
		if (source.getReturnType() != null) {
			return ensureValidType(source.eResource(), source.getReturnType());
		}

		// An super operation was detected => reuse its return type.
		if (overriddenOperation != null) {
			final JvmTypeReference type = overriddenOperation.getReturnType();
			//return cloneWithProxiesFromOtherResource(type, target);
			return this.typeReferences.createDelegateTypeReference(type);
		}

		// Return type is inferred from the operation's expression.
		final XExpression expression = source.getExpression();
		JvmTypeReference returnType = null;
		if (expression != null
				&& ((!(expression instanceof XBlockExpression))
						|| (!((XBlockExpression) expression).getExpressions().isEmpty()))) {
			returnType = inferFunctionReturnType(expression);
		}
		return ensureValidType(source.eResource(), returnType);
	}