PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.5.1
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.5.1
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
code-engine / vendor / nikic / php-parser / lib / PhpParser / PrettyPrinter.php

PrettyPrinter.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.5.1, at vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php

52 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace PhpParser;
4
5 use PhpParser\Node\Expr;
6
7 interface PrettyPrinter {
8 /**
9 * Pretty prints an array of statements.
10 *
11 * @param Node[] $stmts Array of statements
12 *
13 * @return string Pretty printed statements
14 */
15 public function prettyPrint(array $stmts): string;
16
17 /**
18 * Pretty prints an expression.
19 *
20 * @param Expr $node Expression node
21 *
22 * @return string Pretty printed node
23 */
24 public function prettyPrintExpr(Expr $node): string;
25
26 /**
27 * Pretty prints a file of statements (includes the opening <?php tag if it is required).
28 *
29 * @param Node[] $stmts Array of statements
30 *
31 * @return string Pretty printed statements
32 */
33 public function prettyPrintFile(array $stmts): string;
34
35 /**
36 * Perform a format-preserving pretty print of an AST.
37 *
38 * The format preservation is best effort. For some changes to the AST the formatting will not
39 * be preserved (at least not locally).
40 *
41 * In order to use this method a number of prerequisites must be satisfied:
42 * * The startTokenPos and endTokenPos attributes in the lexer must be enabled.
43 * * The CloningVisitor must be run on the AST prior to modification.
44 * * The original tokens must be provided, using the getTokens() method on the lexer.
45 *
46 * @param Node[] $stmts Modified AST with links to original AST
47 * @param Node[] $origStmts Original AST with token offset information
48 * @param Token[] $origTokens Tokens of the original code
49 */
50 public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens): string;
51 }
52