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