/PHP-Parser/lib/PhpParser/PrettyPrinter/ |
H A D | Standard.php | 22 . ($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 D | NameResolver.php | 64 $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 D | NodeConnectingVisitor.php | 41 public function enterNode(Node $node) { argument 45 $node->setAttribute('weak_parent', \WeakReference::create($parent)); 47 $node->setAttribute('parent', $parent); 56 $node->setAttribute('weak_previous', \WeakReference::create($this->previous)); 57 $this->previous->setAttribute('weak_next', \WeakReference::create($node)); 59 } elseif ($this->previous->getAttribute('parent') === $node->getAttribute('parent')) { 60 $node->setAttribute('previous', $this->previous); 61 $this->previous->setAttribute('next', $node); 65 $this->stack[] = $node; 68 public function leaveNode(Node $node) { argument [all …]
|
H A D | ParentConnectingVisitor.php | 35 public function enterNode(Node $node) { argument 39 $node->setAttribute('weak_parent', \WeakReference::create($parent)); 41 $node->setAttribute('parent', $parent); 45 $this->stack[] = $node; 48 public function leaveNode(Node $node) { argument
|
/PHP-Parser/test/PhpParser/ |
H A D | NodeAbstractTest.php | 46 [$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 D | CompatibilityTest.php | 18 $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 D | CodeParsingTest.php | 71 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 D | PropertyTest.php | 12 $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()); 35 $this->assertTrue($node->isPublic()); 37 $this->assertFalse($node->isPrivate()); 38 $this->assertTrue($node->isStatic()); [all …]
|
H A D | ClassMethodTest.php | 15 $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 D | ClassConstTest.php | 12 $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 D | ParamTest.php | 10 $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()); 26 $node = new Param(new Variable('foo')); 43 $node->flags = Modifiers::PRIVATE_SET; 47 $node->flags = Modifiers::PUBLIC_SET; 54 $node->hooks[] = $get; [all …]
|
/PHP-Parser/lib/PhpParser/ |
H A D | NodeDumper.php | 68 /** @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 D | NodeTraverser.php | 91 * @param Node $node Node to traverse. 93 protected function traverseNode(Node $node): void { argument 94 foreach ($node->getSubNodeNames() as $name) { 95 $subNode = $node->$name; 128 $node->$name = null; 157 $node->$name = null; 184 foreach ($nodes as $i => $node) { 185 if (!$node instanceof Node) { 186 if (\is_array($node)) { 196 $return = $visitor->enterNode($node); [all …]
|
H A D | NodeVisitor.php | 83 * @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 D | target.php | 50 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/NodeVisitor/ |
H A D | NodeConnectingVisitorTest.php | 24 $node = (new NodeFinder())->findFirstInstanceof($ast, Else_::class); 26 $this->assertSame(If_::class, get_class($node->getAttribute('parent'))); 27 $this->assertSame(ConstFetch::class, get_class($node->getAttribute('previous'))); 29 $node = (new NodeFinder())->findFirstInstanceof($ast, ConstFetch::class); 31 $this->assertSame(Else_::class, get_class($node->getAttribute('next'))); 45 $node = (new NodeFinder())->findFirstInstanceof($ast, Else_::class); 47 $this->assertInstanceOf(\WeakReference::class, $node->getAttribute('weak_parent')); 48 $this->assertSame(If_::class, get_class($node->getAttribute('weak_parent')->get())); 52 $node = (new NodeFinder())->findFirstInstanceof($ast, ConstFetch::class); 54 $this->assertInstanceOf(\WeakReference::class, $node->getAttribute('weak_next')); [all …]
|
/PHP-Parser/test/PhpParser/Builder/ |
H A D | PropertyTest.php | 26 $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 D | ClassConstTest.php | 24 $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 D | MethodTest.php | 25 $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 D | UseTest.php | 15 $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 D | NamespaceTest.php | 25 $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 D | ParamTest.php | 25 $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 D | FunctionTest.php | 24 $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 D | arrayInsertionWithComments.test | 10 $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 D | FAQ.markdown | 4 * [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')`. 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')`. 65 After enabling this parameter, the parent node can be obtained through `$node->getAttribute('weak_p… 66 the previous node can be obtained through `$node->getAttribute('weak_previous')`, and the next node… [all …]
|