Home
last modified time | relevance | path

Searched refs:nodes (Results 1 – 25 of 35) sorted by relevance

12

/PHP-Parser/lib/PhpParser/
H A DNodeFinder.php17 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 DNodeVisitor.php55 * @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 DNodeTraverser.php63 * @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 DNodeVisitorAbstract.php9 public function beforeTraverse(array $nodes) { argument
21 public function afterTraverse(array $nodes) { argument
H A DNodeTraverserInterface.php21 * @param Node[] $nodes Array of nodes
25 public function traverse(array $nodes): array; argument
H A DPrettyPrinterAbstract.php283 * @param Node[] $nodes Array of nodes
288 foreach ($nodes as $node) {
315 * @param Node[] $nodes Array of nodes
326 foreach ($nodes as $node) {
439 foreach ($nodes as $node) {
458 return $this->pImplode($nodes, ', ');
475 $lastIdx = count($nodes) - 1;
476 foreach ($nodes as $idx => $node) {
741 * @param Node[] $nodes New nodes
1214 if (\count($nodes) < 2) {
[all …]
/PHP-Parser/test/PhpParser/
H A DNodeVisitorForTesting.php15 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 DDNumberTest.php12 $nodes = $parser->parse('<?php echo 1_234.56;');
14 $echo = $nodes[0];
H A DNumberTest.php11 $nodes = $parser->parse('<?php echo 1_234;');
13 $echo = $nodes[0];
H A DStringTest.php11 $nodes = $parser->parse('<?php echo "sequence \x41";');
13 $echo = $nodes[0];
/PHP-Parser/lib/PhpParser/NodeVisitor/
H A DFindingVisitor.php33 public function beforeTraverse(array $nodes): ?array { argument
H A DParentConnectingVisitor.php23 public function beforeTraverse(array $nodes) { argument
H A DFirstFindingVisitor.php34 public function beforeTraverse(array $nodes): ?array { argument
H A DNodeConnectingVisitor.php28 public function beforeTraverse(array $nodes) { argument
/PHP-Parser/doc/component/
H A DAST_builders.markdown6 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 DWalking_the_AST.markdown43 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 DPretty_printing.markdown34 The pretty printer respects a number of `kind` attributes used by some nodes (e.g., whether an
45 * For PHP >= 7.0, short array syntax `[]` will be used by default. This does not affect nodes that
49 `list()`). This does not affect nodes that specify and explicit syntax using the `kind` attribute.
73 attempts to preserve the formatting of code (those AST nodes that have not changed) and only reform…
H A DFAQ.markdown10 The AST does not store parent nodes by default. However, the `ParentConnectingVisitor` can be used …
/PHP-Parser/
H A DUPGRADE-4.0.md13 * 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 DUPGRADE-2.0.md66 * 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 DCHANGELOG.md63 to all nodes sharing a starting position. Now only the outer-most node will hold the comments.
322 `Stmt\EnumCase` nodes.
429 `Expr\NullsafePropertyFetch` and `Expr\NullsafeMethodCall` nodes.
485 * Added `getProperty()` method to `ClassLike` nodes.
603 nodes, and prevent subsequent visitors from visiting the current node.
693 * Fixed insertion into list nodes that require creation of a code block.
707 * Added support for removing from list nodes.
743 nodes. Please see the UPGRADE-4.0 file for an exhaustive list of affected nodes and some notes on
863 error occurred. This made some nodes larger than expected. (#359)
896 * Added `php-parse --with-positions` option, which dumps nodes with position information.
[all …]
H A DUPGRADE-5.0.md150 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 DUPGRADE-3.0.md19 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 D2_Usage_of_basic_components.markdown73 // $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 DREADME.md28 * Fluent builders for AST nodes

Completed in 43 milliseconds

12