Skip to content
Discussion options

You must be logged in to vote

I think you can use native php function for that, for printing content, you can use BetterStandardPrinter::prettyPrintFile() for given stmts for its file content.

https://github.com/rectorphp/rector/blob/62a3cdc00af34a0f2cf4ee7dc2f0a05bef0d3051/src/PhpParser/Printer/BetterStandardPrinter.php#L99C21-L104

$content = $this->betterStandardPrinter->prettyPrintFile($stmts);
file_put_content('/path/to/file.php', $content);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by samsonasik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants