GraphQL\Language\Visitor::removeNode PHP Method

removeNode() public static method

Remove current node
public static removeNode ( )
    public static function removeNode()
    {
        $r = new VisitorOperation();
        $r->removeNode = true;
        return $r;
    }

Usage Example

Ejemplo n.º 1
0
 public function testAllowsForEditingOnLeave()
 {
     $ast = Parser::parse('{ a, b, c { a, b, c } }', ['noLocation' => true]);
     $editedAst = Visitor::visit($ast, ['leave' => function ($node) {
         if ($node instanceof Field && $node->name->value === 'b') {
             return Visitor::removeNode();
         }
     }]);
     $this->assertEquals(Parser::parse('{ a, b, c { a, b, c } }', ['noLocation' => true]), $ast);
     $this->assertEquals(Parser::parse('{ a,    c { a,    c } }', ['noLocation' => true]), $editedAst);
 }
All Usage Examples Of GraphQL\Language\Visitor::removeNode