From f581318dd50392e69c5aac4ee1213c9c6197b164 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 26 Dec 2016 18:34:50 +0100 Subject: [PATCH] Remove leftover file --- formatPreserving.php | 56 -------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 formatPreserving.php diff --git a/formatPreserving.php b/formatPreserving.php deleted file mode 100644 index 5a3c290..0000000 --- a/formatPreserving.php +++ /dev/null @@ -1,56 +0,0 @@ - [ - 'comments', - 'startLine', 'endLine', - 'startFilePos', 'endFilePos', - 'startTokenPos', 'endTokenPos', - ], -]); - -$parser = new PhpParser\Parser\Php7($lexer, [ - 'useIdentifierNodes' => true, - 'useConsistentVariableNodes' => true, - ] -); - -$traverser = new PhpParser\NodeTraverser(); -$traverser->addVisitor(new PhpParser\NodeVisitor\CloningVisitor()); - -$printer = new PhpParser\PrettyPrinter\Standard(); - -$code = <<<'PHP' -parse($code); -$oldTokens = $lexer->getTokens(); - -$newStmts = $traverser->traverse($oldStmts); - -$newStmts[0]->stmts[0]->exprs[0]->left->right->value = 42; -$newStmts[0]->stmts[1] = new Node\Expr\Assign(new Node\Expr\Variable('a'), new Node\Scalar\LNumber(42)); - -$newCode = $printer->printFormatPreserving($newStmts, $oldStmts, $code, $oldTokens); -echo $newCode, "\n"; \ No newline at end of file