type hint Name node in visitor

This commit is contained in:
Andreas Heiberg 2016-11-10 18:36:28 +00:00 committed by vladar
parent 46788f2ddb
commit 816fa067b3

View File

@ -1,7 +1,6 @@
<?php <?php
namespace GraphQL\Language; namespace GraphQL\Language;
use GraphQL\Language\AST\Argument; use GraphQL\Language\AST\Argument;
use GraphQL\Language\AST\DirectiveDefinition; use GraphQL\Language\AST\DirectiveDefinition;
use GraphQL\Language\AST\EnumTypeDefinition; use GraphQL\Language\AST\EnumTypeDefinition;
@ -22,6 +21,7 @@ use GraphQL\Language\AST\FragmentSpread;
use GraphQL\Language\AST\InlineFragment; use GraphQL\Language\AST\InlineFragment;
use GraphQL\Language\AST\IntValue; use GraphQL\Language\AST\IntValue;
use GraphQL\Language\AST\ListType; use GraphQL\Language\AST\ListType;
use GraphQL\Language\AST\Name;
use GraphQL\Language\AST\NamedType; use GraphQL\Language\AST\NamedType;
use GraphQL\Language\AST\Node; use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeType; use GraphQL\Language\AST\NodeType;
@ -45,7 +45,7 @@ class Printer
{ {
return Visitor::visit($ast, [ return Visitor::visit($ast, [
'leave' => [ 'leave' => [
NodeType::NAME => function($node) { NodeType::NAME => function(Node $node) {
return '' . $node->value; return '' . $node->value;
}, },
NodeType::VARIABLE => function($node) { NodeType::VARIABLE => function($node) {