Home
last modified time | relevance | path

Searched refs:node (Results 1 – 25 of 78) sorted by relevance

1234

/PHP-Parser/lib/PhpParser/PrettyPrinter/
H A DStandard.php22 . ($node->type ? $this->p($node->type) . ' ' : '')
26 . ($node->default ? ' = ' . $this->p($node->default) : '')
31 return ($node->name ? $node->name->toString() . ': ' : '')
32 . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '')
41 return $node->name . ' = ' . $this->p($node->value);
718 …$node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->els…
795 return $this->pClassCommon($node, ' ' . $node->name);
819 return $this->p($node->trait) . '::' . $node->method
847 . ($node->byRef ? '&' : '') . $node->name
890 return $node->key . '=' . $this->p($node->value);
[all …]
/PHP-Parser/lib/PhpParser/NodeVisitor/
H A DNameResolver.php64 $this->addAlias($use, $node->type, $node->prefix);
68 $node->extends = $this->resolveClassName($node->extends);
110 $node->type = $this->resolveType($node->type);
125 $node->type = $this->resolveType($node->type);
137 $node->class = $this->resolveClassName($node->class);
188 $node->returnType = $this->resolveType($node->returnType);
193 * @param T $node
201 $node->type = $this->resolveType($node->type);
202 return $node;
208 return $node;
[all …]
H A DNodeConnectingVisitor.php33 public function enterNode(Node $node) { argument
35 $node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
38 …if ($this->previous !== null && $this->previous->getAttribute('parent') === $node->getAttribute('p…
39 $node->setAttribute('previous', $this->previous);
40 $this->previous->setAttribute('next', $node);
43 $this->stack[] = $node;
46 public function leaveNode(Node $node) { argument
47 $this->previous = $node;
H A DParentConnectingVisitor.php27 public function enterNode(Node $node) { argument
29 $node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
32 $this->stack[] = $node;
35 public function leaveNode(Node $node) { argument
/PHP-Parser/test/PhpParser/
H A DNodeAbstractTest.php46 [$attributes, $node],
72 return $node;
80 $comments = $node->getComments();
96 $node->setDocComment($docComment);
101 $node->setDocComment($docComment);
124 $node->subNode1 = 'newValue';
128 $subNode = &$node->subNode1;
133 unset($node->subNode1);
186 $node->getAttributes()
189 $node->setAttributes(
[all …]
H A DCompatibilityTest.php18 $node = new Node\ClosureUse($var);
20 $node = new Node\ArrayItem($var);
22 $node = new Node\StaticVar($var);
24 $node = new Scalar\Float_(1.0);
26 $node = new Scalar\Int_(1);
34 $node = new Node\PropertyItem('x');
48 $node = new Node\Expr\ArrayItem($var);
50 $node = new Node\Stmt\StaticVar($var);
52 $node = new Node\Scalar\DNumber(1.0);
54 $node = new Node\Scalar\LNumber(1);
[all …]
H A DCodeParsingTest.php71 public function enterNode(Node $node): void { argument
72 $startLine = $node->getStartLine();
73 $endLine = $node->getEndLine();
74 $startFilePos = $node->getStartFilePos();
75 $endFilePos = $node->getEndFilePos();
76 $startTokenPos = $node->getStartTokenPos();
77 $endTokenPos = $node->getEndTokenPos();
82 throw new \Exception('Missing location information on ' . $node->getType());
91 if (!$node instanceof Stmt\Nop && !$node instanceof Expr\Error &&
92 !$node instanceof Node\Param
[all …]
/PHP-Parser/test/PhpParser/Node/Stmt/
H A DPropertyTest.php12 $node = new Property(
21 $node = new Property(0, []);
23 $this->assertTrue($node->isPublic());
24 $this->assertFalse($node->isProtected());
25 $this->assertFalse($node->isPrivate());
26 $this->assertFalse($node->isStatic());
27 $this->assertFalse($node->isReadonly());
28 $this->assertFalse($node->isPublicSet());
35 $this->assertTrue($node->isPublic());
37 $this->assertFalse($node->isPrivate());
[all …]
H A DClassMethodTest.php15 $node = new ClassMethod('foo', [
23 $node = new ClassMethod('foo', ['type' => 0]);
25 $this->assertTrue($node->isPublic());
26 $this->assertFalse($node->isProtected());
27 $this->assertFalse($node->isPrivate());
28 $this->assertFalse($node->isAbstract());
29 $this->assertFalse($node->isFinal());
30 $this->assertFalse($node->isStatic());
31 $this->assertFalse($node->isMagic());
53 $node = new ClassMethod('foo', [
[all …]
H A DClassConstTest.php12 $node = new ClassConst(
17 $this->assertTrue($node->{'is' . $modifier}());
21 $node = new ClassConst([], 0);
23 $this->assertTrue($node->isPublic());
24 $this->assertFalse($node->isProtected());
25 $this->assertFalse($node->isPrivate());
26 $this->assertFalse($node->isFinal());
/PHP-Parser/test/PhpParser/Node/
H A DParamTest.php10 $node = new Param(new Variable('foo'));
12 $this->assertFalse($node->isPromoted());
13 $this->assertFalse($node->isPrivate());
14 $this->assertFalse($node->isProtected());
15 $this->assertFalse($node->isPrivate());
16 $this->assertFalse($node->isReadonly());
17 $this->assertFalse($node->isPublicSet());
26 $node = new Param(new Variable('foo'));
28 $this->assertTrue($node->isPromoted());
43 $node->flags = Modifiers::PRIVATE_SET;
[all …]
/PHP-Parser/lib/PhpParser/
H A DNodeDumper.php68 /** @param mixed $node */
73 if ($node instanceof Node) {
83 $value = $node->$key;
94 … && ($node instanceof Use_ || $node instanceof UseItem || $node instanceof GroupUse)) {
120 if ($node instanceof String_ || $node instanceof InterpolatedString) {
149 } elseif (\is_int($node) || \is_float($node)) {
150 $this->res .= $node;
151 } elseif (null === $node) {
155 } elseif (true === $node) {
271 if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) {
[all …]
H A DNodeTraverser.php91 * @param Node $node Node to traverse.
93 protected function traverseNode(Node $node): void { argument
94 foreach ($node->getSubNodeNames() as $name) {
95 $subNode = $node->$name;
121 $node->$name = null;
150 $node->$name = null;
178 foreach ($nodes as $i => $node) {
179 if ($node instanceof Node) {
184 $return = $visitor->enterNode($node);
215 $this->traverseNode($node);
[all …]
H A DNodeVisitor.php83 * @param Node $node Node
87 public function enterNode(Node $node); argument
106 * @param Node $node Node
110 public function leaveNode(Node $node); argument
/PHP-Parser/tools/fuzzing/
H A Dtarget.php50 public function leaveNode(PhpParser\Node $node) { argument
52 if ($node instanceof Stmt\Nop) {
57 if ($node instanceof Expr\List_) {
58 while (!empty($node->items) && $node->items[count($node->items) - 1] === null) {
59 array_pop($node->items);
65 if ($node instanceof Scalar\Int_ && $node->value < 0) {
66 if ($node->value === \PHP_INT_MIN) {
79 if ($node instanceof Expr\ConstFetch && $node->name->isUnqualified() &&
80 in_array($node->name->toLowerString(), self::CAST_NAMES)
88 if ($node instanceof Stmt\Use_ && $node->uses[0]->name->isUnqualified() &&
[all …]
/PHP-Parser/test/PhpParser/Builder/
H A DPropertyTest.php26 $node = $this->createPropertyBuilder('test')
37 $node
50 $node
63 $node
76 $node
84 $node);
91 $node);
98 $node);
120 ), $node);
157 $node
[all …]
H A DClassConstTest.php24 $node = $this->createClassConstBuilder("TEST", 1)
36 $node
39 $node = $this->createClassConstBuilder("TEST", 1)
51 $node
54 $node = $this->createClassConstBuilder("TEST", 1)
66 $node
81 $node
101 $node
117 $node
141 $node
[all …]
H A DMethodTest.php25 $node = $this->createMethodBuilder('test')
37 $node
40 $node = $this->createMethodBuilder('test')
50 $node
62 $node
76 $node
95 $node
118 $node
128 ]), $node);
144 ], []), $node);
[all …]
H A DUseTest.php15 $node = $this->createUseBuilder('Foo\Bar')->getNode();
18 ]), $node);
20 $node = $this->createUseBuilder(new Name('Foo\Bar'))->as('XYZ')->getNode();
23 ]), $node);
25 $node = $this->createUseBuilder('foo\bar', Stmt\Use_::TYPE_FUNCTION)->as('foo')->getNode();
28 ], Stmt\Use_::TYPE_FUNCTION), $node);
30 $node = $this->createUseBuilder('foo\BAR', Stmt\Use_::TYPE_CONSTANT)->as('FOO')->getNode();
33 ], Stmt\Use_::TYPE_CONSTANT), $node);
H A DNamespaceTest.php25 $node = $this->createNamespaceBuilder('Name\Space')
31 $this->assertEquals($expected, $node);
33 $node = $this->createNamespaceBuilder(new Node\Name(['Name', 'Space']))
39 $this->assertEquals($expected, $node);
41 $node = $this->createNamespaceBuilder(null)->getNode();
42 $this->assertNull($node->name);
43 $this->assertEmpty($node->stmts);
H A DParamTest.php25 $node = $this->createParamBuilder('test')
97 $type = $node->type;
192 $node
204 $node
216 $node
228 $node
238 $node
250 $node
260 $node
272 $node
[all …]
H A DFunctionTest.php24 $node = $this->createFunctionBuilder('test')
33 $node
42 $node = $this->createFunctionBuilder('test')
52 $node
61 $node = $this->createFunctionBuilder('test')
75 $node
80 $node = $this->createFunctionBuilder('test')
86 ]), $node);
102 ], []), $node);
106 $node = $this->createFunctionBuilder('test')
[all …]
/PHP-Parser/test/code/formatPreservation/
H A DarrayInsertionWithComments.test10 $node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
11 $node->setAttribute('comments', [new Comment\Doc(<<<COMMENT
18 $array->items[] = $node;
39 $node->setAttribute('comments', [new Comment("/* Block comment */")]);
41 $array->items[] = $node;
60 $node->setAttribute('comments', [new Comment("// Line comment")]);
62 $array->items[] = $node;
80 $node->setAttribute('comments', [new Comment("// Line comment")]);
82 $array->items[] = $node;
97 $node->setAttribute('comments', [new Comment("// Line comment")]);
[all …]
/PHP-Parser/doc/component/
H A DFAQ.markdown4 * [How can the parent of a node be obtained?](#how-can-the-parent-of-a-node-be-obtained)
5 …* [How can the next/previous sibling of a node be obtained?](#how-can-the-nextprevious-sibling-of-…
7 How can the parent of a node be obtained?
26 After running this visitor, the parent node can be obtained through `$node->getAttribute('parent')`.
28 How can the next/previous sibling of a node be obtained?
32 the previous / next node with a common parent as well:
48 After running this visitor, the parent node can be obtained through `$node->getAttribute('parent')`,
49 the previous node can be obtained through `$node->getAttribute('previous')`, and the next node can …
50 obtained through `$node->getAttribute('next')`.
H A DWalking_the_AST.markdown4 The most common way to work with the AST is by using a node traverser and one or more node visitors.
109 $node->value++;
114 The second is to replace a node entirely by returning a new node:
197 if ($node instanceof Node\Stmt\Return_ && $node->expr !== null) {
224 $this->classes[] = $node;
244 $this->class = $node;
312 * If a visitor returns a replacement node, subsequent visitors will be passed the replacement node,
319 Simple node finding
322 While the node visitor mechanism is very flexible, creating a node visitor can be overly cumbersome
338 && $node->extends !== null;
[all …]

Completed in 38 milliseconds

1234