Cleaning up old unused messages

This commit is contained in:
vladar 2016-12-06 03:45:52 +07:00
parent a165c3aaab
commit c5bba0e7d4
13 changed files with 0 additions and 182 deletions

View File

@ -1,139 +0,0 @@
<?php
namespace GraphQL\Validator;
use GraphQL\Utils;
class Messages
{
static function missingArgMessage($fieldName, $argName, $typeName)
{
return "Field $fieldName argument $argName of type $typeName, is required but not provided.";
}
static function badValueMessage($argName, $typeName, $value)
{
return "Argument $argName expected type $typeName but got: $value.";
}
static function fragmentOnNonCompositeErrorMessage($fragName, $typeName)
{
return "Fragment $fragName cannot condition on non composite type \"$typeName\".";
}
static function inlineFragmentOnNonCompositeErrorMessage($typeName)
{
return "Fragment cannot condition on non composite type \"$typeName\".";
}
static function unknownArgMessage($argName, $fieldName, $typeName)
{
return "Unknown argument $argName on field $fieldName of type $typeName.";
}
static function unknownTypeMessage($typeName)
{
return "Unknown type $typeName.";
}
static function undefinedVarMessage($varName)
{
return "Variable \$$varName is not defined.";
}
static function undefinedVarByOpMessage($varName, $opName)
{
return "Variable \$$varName is not defined by operation $opName.";
}
static function unusedFragMessage($fragName)
{
return "Fragment $fragName is not used.";
}
static function unusedVariableMessage($varName)
{
return "Variable \$$varName is not used.";
}
static function typeIncompatibleSpreadMessage($fragName, $parentType, $fragType)
{
return "Fragment \"$fragName\" cannot be spread here as objects of " .
"type \"$parentType\" can never be of type \"$fragType\".";
}
static function typeIncompatibleAnonSpreadMessage($parentType, $fragType)
{
return "Fragment cannot be spread here as objects of " .
"type \"$parentType\" can never be of type \"$fragType\".";
}
static function noSubselectionAllowedMessage($field, $type)
{
return "Field \"$field\" of type $type must not have a sub selection.";
}
static function requiredSubselectionMessage($field, $type)
{
return "Field \"$field\" of type $type must have a sub selection.";
}
static function nonInputTypeOnVarMessage($variableName, $typeName)
{
return "Variable $${variableName} cannot be non input type $typeName.";
}
static function cycleErrorMessage($fragmentName, $spreadNames)
{
return "Cannot spread fragment $fragmentName within itself" .
(!empty($spreadNames) ? (" via " . implode(', ', $spreadNames)) : '') . '.';
}
static function unknownDirectiveMessage($directiveName)
{
return "Unknown directive $directiveName.";
}
static function misplacedDirectiveMessage($directiveName, $placement)
{
return "Directive $directiveName may not be used on $placement.";
}
static function missingDirectiveValueMessage($directiveName, $typeName)
{
return "Directive $directiveName expects a value of type $typeName.";
}
static function noDirectiveValueMessage($directiveName)
{
return "Directive $directiveName expects no value.";
}
static function badDirectiveValueMessage($directiveName, $typeName, $value)
{
return "Directive $directiveName expected type $typeName but " .
"got: $value.";
}
static function fieldsConflictMessage($responseName, $reason)
{
$reasonMessage = self::reasonMessage($reason);
return "Fields $responseName conflict because {$reasonMessage}.";
}
/**
* @param array|string $reason
* @return array
*/
private static function reasonMessage($reason)
{
if (is_array($reason)) {
$tmp = array_map(function($tmp) {
list($responseName, $subReason) = $tmp;
$reasonMessage = self::reasonMessage($subReason);
return "subfields $responseName conflict because $reasonMessage";
}, $reason);
return implode(' and ', $tmp);
}
return $reason;
}
}

View File

@ -1,18 +1,12 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\ArgumentNode;
use GraphQL\Language\AST\FieldNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\Printer;
use GraphQL\Language\Visitor;
use GraphQL\Type\Definition\NonNull;
use GraphQL\Utils;
use GraphQL\Validator\DocumentValidator;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class ArgumentsOfCorrectType

View File

@ -1,15 +1,12 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FieldNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Schema;
use GraphQL\Type\Definition\AbstractType;
use GraphQL\Utils;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class FieldsOnCorrectType

View File

@ -1,16 +1,12 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FragmentDefinitionNode;
use GraphQL\Language\AST\InlineFragmentNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\Printer;
use GraphQL\Type\Definition\CompositeType;
use GraphQL\Type\Definition\Type;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class FragmentsOnCompositeTypes

View File

@ -1,13 +1,10 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\ArgumentNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Utils;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class KnownArgumentNames

View File

@ -1,17 +1,10 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FragmentDefinitionNode;
use GraphQL\Language\AST\FragmentSpreadNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\AST\OperationDefinitionNode;
use GraphQL\Language\AST\VariableNode;
use GraphQL\Language\AST\VariableDefinitionNode;
use GraphQL\Language\Visitor;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
/**

View File

@ -1,14 +1,10 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FragmentDefinitionNode;
use GraphQL\Language\AST\FragmentSpreadNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\Visitor;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class NoUnusedFragments

View File

@ -1,13 +1,9 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\AST\OperationDefinitionNode;
use GraphQL\Language\Visitor;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class NoUnusedVariables

View File

@ -1,13 +1,10 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FieldNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Type\Definition\Type;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class ScalarLeafs

View File

@ -1,19 +1,13 @@
<?php
namespace GraphQL\Validator\Rules;
use GraphQL\Error\Error;
use GraphQL\Language\AST\FragmentSpreadNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeKind;
use GraphQL\Language\AST\OperationDefinitionNode;
use GraphQL\Language\AST\VariableNode;
use GraphQL\Language\AST\VariableDefinitionNode;
use GraphQL\Language\Visitor;
use GraphQL\Type\Definition\ListOfType;
use GraphQL\Type\Definition\NonNull;
use GraphQL\Utils\TypeInfo;
use GraphQL\Validator\Messages;
use GraphQL\Validator\ValidationContext;
class VariablesInAllowedPosition

View File

@ -3,7 +3,6 @@ namespace GraphQL\Tests\Validator;
use GraphQL\Error\FormattedError;
use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\DefaultValuesOfCorrectType;
class DefaultValuesOfCorrectTypeTest extends TestCase

View File

@ -3,7 +3,6 @@ namespace GraphQL\Tests\Validator;
use GraphQL\Error\FormattedError;
use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\FieldsOnCorrectType;
class FieldsOnCorrectTypeTest extends TestCase

View File

@ -3,7 +3,6 @@ namespace GraphQL\Tests\Validator;
use GraphQL\Error\FormattedError;
use GraphQL\Language\SourceLocation;
use GraphQL\Validator\Messages;
use GraphQL\Validator\Rules\VariablesInAllowedPosition;
class VariablesInAllowedPositionTest extends TestCase