GraphQL\Type\Definition\Type::resolve PHP Méthode

resolve() public static méthode

public static resolve ( $type ) : mixed
$type
Résultat mixed
    public static function resolve($type)
    {
        if (is_callable($type)) {
            trigger_error('Passing type as closure is deprecated (see https://github.com/webonyx/graphql-php/issues/35 for alternatives)', E_USER_DEPRECATED);
            $type = $type();
        }
        if (!$type instanceof Type) {
            throw new InvariantViolation(sprintf('Expecting instance of ' . __CLASS__ . ', got "%s"', Utils::getVariableType($type)));
        }
        return $type;
    }

Usage Example

 public function getType()
 {
     if (null === $this->resolvedType) {
         $this->resolvedType = Type::resolve($this->type);
     }
     return $this->resolvedType;
 }
All Usage Examples Of GraphQL\Type\Definition\Type::resolve