src/Validator/DocumentValidator.php
public static function getRule($name)
    {
        $rules = static::allRules();

        if (isset($rules[$name])) {
            return $rules[$name];
        }

        $name = sprintf('GraphQL\\Validator\\Rules\\%s', $name);

        return $rules[$name] ?? null;
    }
public static function getRule($name)
    {
        $rules = static::allRules();

        if (isset($rules[$name])) {
            return $rules[$name];
        }

        $name = sprintf('GraphQL\\Validator\\Rules\\%s', $name);

        return $rules[$name] ?? null;
    }
public static function getRule ( $ name ) { $ rules = static :: allRules ( ) ; if ( isset ( $ rules [ $ name ] ) ) { return $ rules [ $ name ] ; } $ name = sprintf ( 'GraphQL\\Validator\\Rules\\%s' , $ name ) ; return $ rules [ $ name ] ?? null ; }
Returns global validation rule by name. Standard rules are named by class name, so
example usage for such rules:

$rule = DocumentValidator::getRule(GraphQL\Validator\Rules\QueryComplexity::class);

@param string $name

@return ValidationRule

@api
Returns global validation rule by name . Standard rules are named by class name so example usage for such rules :