/PHP-Parser/lib/PhpParser/ |
H A D | NodeFinder.php | 17 public function find($nodes, callable $filter): array { argument 18 if ($nodes === []) { 22 if (!is_array($nodes)) { 23 $nodes = [$nodes]; 29 $traverser->traverse($nodes); 44 public function findInstanceOf($nodes, string $class): array { argument 58 public function findFirst($nodes, callable $filter): ?Node { argument 59 if ($nodes === []) { 63 if (!is_array($nodes)) { 64 $nodes = [$nodes]; [all …]
|
H A D | NodeVisitor.php | 55 * @param Node[] $nodes Array of nodes 59 public function beforeTraverse(array $nodes); argument 119 * @param Node[] $nodes Array of nodes 123 public function afterTraverse(array $nodes); argument
|
H A D | NodeTraverser.php | 63 * @param Node[] $nodes Array of nodes 67 public function traverse(array $nodes): array { argument 72 $nodes = $return; 76 $nodes = $this->traverseArray($nodes); 81 $nodes = $return; 85 return $nodes; 171 * @param array $nodes Array to traverse 178 foreach ($nodes as $i => $node) { 188 $nodes[$i] = $node = $return; 255 array_splice($nodes, $i, 1, $replace); [all …]
|
H A D | NodeVisitorAbstract.php | 9 public function beforeTraverse(array $nodes) { argument 21 public function afterTraverse(array $nodes) { argument
|
H A D | NodeTraverserInterface.php | 21 * @param Node[] $nodes Array of nodes 25 public function traverse(array $nodes): array; argument
|
H A D | PrettyPrinterAbstract.php | 311 * @param Node[] $nodes Array of nodes 316 foreach ($nodes as $node) { 343 * @param Node[] $nodes Array of nodes 354 foreach ($nodes as $node) { 467 foreach ($nodes as $node) { 486 return $this->pImplode($nodes, ', '); 503 $lastIdx = count($nodes) - 1; 504 foreach ($nodes as $idx => $node) { 769 * @param Node[] $nodes New nodes 1245 if (\count($nodes) < 2) { [all …]
|
/PHP-Parser/test/PhpParser/ |
H A D | NodeVisitorForTesting.php | 15 public function beforeTraverse(array $nodes): ?array { argument 16 return $this->traceEvent('beforeTraverse', $nodes); 27 public function afterTraverse(array $nodes): ?array { argument 28 return $this->traceEvent('afterTraverse', $nodes);
|
/PHP-Parser/test/PhpParser/Node/Scalar/ |
H A D | DNumberTest.php | 12 $nodes = $parser->parse('<?php echo 1_234.56;'); 14 $echo = $nodes[0];
|
H A D | NumberTest.php | 11 $nodes = $parser->parse('<?php echo 1_234;'); 13 $echo = $nodes[0];
|
H A D | StringTest.php | 11 $nodes = $parser->parse('<?php echo "sequence \x41";'); 13 $echo = $nodes[0];
|
/PHP-Parser/lib/PhpParser/NodeVisitor/ |
H A D | FindingVisitor.php | 33 public function beforeTraverse(array $nodes): ?array { argument
|
H A D | ParentConnectingVisitor.php | 23 public function beforeTraverse(array $nodes) { argument
|
H A D | FirstFindingVisitor.php | 34 public function beforeTraverse(array $nodes): ?array { argument
|
H A D | NodeConnectingVisitor.php | 28 public function beforeTraverse(array $nodes) { argument
|
/PHP-Parser/doc/component/ |
H A D | AST_builders.markdown | 6 be tedious to manually construct AST nodes. The project provides a number of utilities to simplify 7 the construction of common AST nodes. 63 // it is possible to add manually created nodes 117 nodes. The following methods are currently available: 122 wrappers. Also converts literals to AST nodes. 136 * `concat(...$exprs)`: Create a tree of `BinaryOp\Concat` nodes for the given expressions.
|
H A D | Walking_the_AST.markdown | 43 public function beforeTraverse(array $nodes); 46 public function afterTraverse(array $nodes); 155 sense to remove nodes of type `Node\Stmt`, as they always occur inside statement lists (and a few 178 Another way to remove nodes is to replace them with `null`. For example, all `else` statements could 192 Next to removing nodes, it is also possible to replace one node with multiple nodes. This 211 An AST can easily contain thousands of nodes, and traversing over all of them may be slow, 217 checking all it's child nodes, because PHP does not allow nesting classes. In this case, you can 317 that was replaced, nor the replacement nodes. 323 for minor tasks. For this reason a `NodeFinder` is provided, which can find AST nodes that either 332 // Find all class nodes. [all …]
|
H A D | Pretty_printing.markdown | 34 The pretty printer respects a number of `kind` attributes used by some nodes (e.g., whether an 46 * For PHP >= 7.0, short array syntax `[]` will be used by default. This does not affect nodes that 50 `list()`). This does not affect nodes that specify and explicit syntax using the `kind` attribute. 74 attempts to preserve the formatting of code (those AST nodes that have not changed) and only reform…
|
H A D | FAQ.markdown | 10 The AST does not store parent nodes by default. However, the `ParentConnectingVisitor` can be used …
|
/PHP-Parser/ |
H A D | UPGRADE-4.0.md | 13 * Many subnodes that previously held simple strings now store `Identifier` nodes instead (or 14 `VarLikeIdentifier` nodes if they have form `$ident`). The constructors of the affected nodes will 65 * Removed `type` subnode on `Class_`, `ClassMethod` and `Property` nodes. Use `flags` instead.
|
H A D | UPGRADE-2.0.md | 66 * The `NodeTraverser` no longer clones nodes by default. If you want to restore the old behavior, 68 * The legacy node format has been removed. If you use custom nodes, they are now expected to 72 * String parts of encapsed strings are now represented using `Scalar\EncapsStringPart` nodes, while
|
H A D | CHANGELOG.md | 19 * Include the trailing semicolon inside `Stmt\GroupUse` nodes, making them consistent with 20 `Stmt\Use_` nodes. 374 `Stmt\EnumCase` nodes. 481 `Expr\NullsafePropertyFetch` and `Expr\NullsafeMethodCall` nodes. 537 * Added `getProperty()` method to `ClassLike` nodes. 655 nodes, and prevent subsequent visitors from visiting the current node. 745 * Fixed insertion into list nodes that require creation of a code block. 759 * Added support for removing from list nodes. 795 nodes. Please see the UPGRADE-4.0 file for an exhaustive list of affected nodes and some notes on 915 error occurred. This made some nodes larger than expected. (#359) [all …]
|
H A D | UPGRADE-5.0.md | 150 Previously, `Name` nodes had a `parts` subnode, which stores an array of name parts, split by 151 namespace separators. Now, `Name` nodes instead have a `name` subnode, which stores a plain string. 231 Previously, comments were assigned to all nodes starting at the same position. Now they will be 276 ### Renamed nodes 278 A number of AST nodes have been renamed or moved in the AST hierarchy: 296 …de\Stmt\Class_`, to make it clearer that these are used by many different nodes. The old constants… 394 …t), short array syntax `[]` will be used by default. This does not affect nodes that specify an ex… 396 … for destructuring by default (instead of `list()`). This does not affect nodes that specify an ex… 404 …ty printer. The internal `p()` method, which is used to recursively print nodes, now has the follo… 495 Responsibility for determining start and end attributes for nodes has been moved from the lexer to …
|
H A D | UPGRADE-3.0.md | 19 The following changes are likely to require code changes if the respective nodes are used: 123 The constructors of certain nodes used to contain additional checks for semantic errors, such as 128 This means that certain error conditions are no longer checked for manually constructed nodes. 141 * `$cloneNodes` argument of `NodeTraverser::__construct()`. Explicitly clone nodes in the visitor
|
/PHP-Parser/doc/ |
H A D | 2_Usage_of_basic_components.markdown | 73 // $stmts is an array of statement nodes 168 nodes, a `Stmt_Function` and a `Stmt_Expression`. The corresponding class names are: 177 As PHP is a large language there are approximately 140 different nodes. In order to make working 180 * `PhpParser\Node\Stmt`s are statement nodes, i.e. language constructs that do not return 183 * `PhpParser\Node\Expr`s are expression nodes, i.e. language constructs that return a value 186 * `PhpParser\Node\Scalar`s are nodes representing scalar values, like `'string'` 190 * There are some nodes not in either of these groups, for example names (`PhpParser\Node\Name`) 333 public function beforeTraverse(array $nodes); 336 public function afterTraverse(array $nodes); 358 * `NodeVisitor::STOP_TRAVERSAL`, in which case no further nodes will be visited. [all …]
|
H A D | README.md | 28 * Fluent builders for AST nodes
|