Lines Matching refs:is
21 This ensures that there will be no errors when traversing highly nested node trees. However, it is
53 order to create a syntax tree. If a syntax error is encountered, a `PhpParser\Error` exception will
73 // $stmts is an array of statement nodes
162 This can be very helpful if you want to quickly check how certain syntax is represented in the AST.
167 Looking at the node dump above, you can see that `$stmts` for this example code is an array of two
173 The additional `_` at the end of the first class name is necessary, because `Function` is a
177 As PHP is a large language there are approximately 140 different nodes. In order to make working
181 a value and can not occur in an expression. For example a class definition is a statement.
193 The `Node\Stmt\Expression` node is somewhat confusing in that it contains both the terms "statement"
194 and "expression". This node distinguishes `expr`, which is a `Node\Expr`, from `expr;`, which is
202 All nodes also define a `getType()` method that returns the node type. The type is the class name
206 It is possible to associate custom metadata with a node using the `setAttribute()` method. This data
210 `startFilePos`, `endFilePos` and `comments` attributes. `comments` is an array of
221 Currently, there is only one scheme available, namely `PhpParser\PrettyPrinter\Standard`.
260 The `prettyPrint()` method pretty prints a statements array. It is also possible to pretty print on…
266 There is also a pretty-printing mode which retains formatting for parts of the AST that have not
275 write code that accesses a certain part of a node tree and changes it. Normally this is not the cas…
276 …ually you want to change / analyze code in a generic way, where you don't know how the node tree is
339 The `beforeTraverse()` method is called once before the traversal begins and is passed the nodes the
343 The `afterTraverse()` method is similar to the `beforeTraverse()` method, with the only difference …
344 it is called once after the traversal.
346 The `enterNode()` and `leaveNode()` methods are called on every node, the former when it is entered,
347 i.e. before its subnodes are traversed, the latter when it is left.
350 case the current node is not changed.
373 One visitor that is already bundled with the package is `PhpParser\NodeVisitor\NameResolver`. This …
381 In order to know that `B\C` really is `A\C` you would need to track aliases and namespaces yourself.
386 know which function they are referring to. In most cases this is a non-issue as the global functions
390 declarations that contains the namespaced name instead of only the shortname that is available via
451 is convert `A\\B` style names to `A_B` style ones.
468 by underscores instead of backslashes. This is what `str_replace('\\', '_', $node->toString())` doe…
472 Another thing we need to do is change the class/function/const declarations. Currently they contain
498 There is not much more to it than converting the namespaced name to string with `_` as separator.
500 The last thing we need to do is remove the `namespace` and `use` statements:
521 // returning an array merges is into the parent array