Home
last modified time | relevance | path

Searched refs:new (Results 1 – 25 of 74) sorted by relevance

123

/PHP-Parser/test/code/prettyPrinter/expr/
H A DnewVariable.test4 new ('a' . 'b');
5 new (x);
6 new (foo());
7 new ('foo');
8 new (x[0]);
9 new (x->y);
10 new ((x)::$y);
15 new (x)();
16 new (foo())();
18 new (x[0])();
[all …]
H A DanonymousClass.test5 new class {};
6 new class extends A implements B, C {};
7 new class($a) extends A {
13 new readonly class {};
15 new class
18 new class extends A implements B, C
21 new class($a) extends A
29 new readonly class
H A Dvariables.test33 (new A)->b;
34 (new A())->b();
35 (new $$a)[$b];
36 (new $a->b)->c;
68 (new A())->b;
69 (new A())->b();
70 (new ${$a}())[$b];
71 (new $a->b())->c;
/PHP-Parser/test/code/formatPreservation/
H A Dfixup.test13 $stmts[0]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
15 $stmts[1]->expr->right = new Expr\BinaryOp\Plus(new Expr\Variable('b'), new Expr\Variable('c'));
17 $stmts[2]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
19 $stmts[3]->expr->cond = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
20 $stmts[3]->expr->if = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
21 $stmts[3]->expr->else = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
23 $stmts[4]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
24 $stmts[5]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
45 new Foo();
53 $stmts[1]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
[all …]
H A DemptyListInsertion.test38 $stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('a'));
39 $stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('b'));
40 $stmts[1]->stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('a'));
42 $stmts[2]->expr->params[] = new Node\Param(new Node\Expr\Variable('a'));
43 $stmts[2]->expr->params[] = new Node\Param(new Node\Expr\Variable('b'));
46 $stmts[3]->expr->params[] = new Node\Param(new Node\Expr\Variable('a'));
47 $stmts[3]->expr->params[] = new Node\Param(new Node\Expr\Variable('b'));
75 new
79 new class
104 new
[all …]
H A DanonClasses.test4 new class
9 $new = $stmts[0]->expr;
10 $new->class->extends = null;
11 $new->args[] = new Expr\Variable('y');
14 new class
19 new class
23 $new = $stmts[0]->expr;
24 $new->class->name = new Node\Identifier('Anon1');
27 new class
H A DlistInsertion.test8 $stmts[] = new Stmt\Expression(new Expr\Variable('baz'));
102 $stmts[0]->catches[] = new Stmt\Catch_([new Node\Name('Bar')], new Expr\Variable('bar'), []);
114 $node = new Stmt\Expression(new Expr\Variable('baz'));
128 $node = new Stmt\Expression(new Expr\Variable('baz'));
155 $node = new Stmt\Expression(new Expr\Variable('baz'));
169 $node = new Stmt\Expression(new Expr\Variable('baz'));
187 $node = new Stmt\Expression(new Expr\Variable('baz'));
250 new Stmt\Expression(new Expr\Variable('a')),
251 new Stmt\Expression(new Expr\Variable('b')));
267 new Stmt\Expression(new Expr\Variable('a')),
[all …]
H A DarrayInsertionWithComments.test10 $node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
11 $node->setAttribute('comments', [new Comment\Doc(<<<COMMENT
38 $node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
39 $node->setAttribute('comments', [new Comment("/* Block comment */")]);
59 $node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
60 $node->setAttribute('comments', [new Comment("// Line comment")]);
79 $node = new Expr\ArrayItem(new Scalar\String_('bar'), new Scalar\String_('b'));
80 $node->setAttribute('comments', [new Comment("// Line comment")]);
96 $node = new Expr\ArrayItem(new Scalar\String_('foo'), new Scalar\String_('a'));
97 $node->setAttribute('comments', [new Comment("// Line comment")]);
H A DinsertionOfNullable.test77 $stmts[0]->returnType = new Node\Name('Foo');
80 $stmts[0]->params[1]->default = new Expr\ConstFetch(new Node\Name('null'));
81 $stmts[1]->expr->dim = new Expr\Variable('a');
84 $stmts[4]->expr->if = new Expr\Variable('z');
87 $stmts[7]->num = new Scalar\LNumber(2);
88 $stmts[8]->num = new Scalar\LNumber(2);
89 $stmts[9]->expr = new Expr\Variable('x');
94 $stmts[11]->keyVar = new Expr\Variable('z');
96 $stmts[13]->finally = new Stmt\Finally_([]);
97 $stmts[14]->else = new Stmt\Else_([]);
[all …]
H A Dindent.test6 $stmts[0] = new Stmt\If_(new Expr\Variable('a'), ['stmts' => $stmts]);
17 $stmts[0] = new Stmt\If_(new Expr\Variable('a'), ['stmts' => $stmts]);
30 $stmts[0]->stmts[] = new Stmt\Expression(new Expr\Variable('y'));
48 $stmts[0]->expr = new Expr\StaticCall(new Node\Name\FullyQualified('Compat'), $call->name, $call->a…
63 $stmts[0] = new Stmt\While_($stmts[0]->cond, $stmts[0]->stmts);
H A DclassMethodNop.test11 $stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
30 $stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
49 $stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("/* I'm a new comment */")]);
55 /* I'm a new comment */
68 $stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("// I'm a new comment")]);
74 // I'm a new comment
H A Dproperty_hooks.test11 $stmts[0]->stmts[0]->hooks[] = new Node\PropertyHook('set', new Scalar\Int_(123));
30 $stmts[0]->stmts[0]->params[0]->hooks[] = new Node\PropertyHook('set', new Scalar\Int_(123));
51 $stmts[0]->stmts[0]->hooks[0]->body[] = new Stmt\Expression(new Expr\Variable('b'));
91 $stmts[0]->stmts[0]->hooks[0]->body = [new Stmt\Return_(new Scalar\Int_(24))];
114 $stmts[0]->stmts[0]->hooks[0]->body = new Scalar\Int_(24);
115 $stmts[0]->stmts[1]->hooks[0]->body = [new Stmt\Return_(new Scalar\Int_(24))];
H A Dattributes.test27 new #[A] class {};
32 $attrGroup = new Node\AttributeGroup([
33 new Node\Attribute(new Node\Name('B'), []),
78 new #[A] #[B] class {};
100 new class {};
105 $attrGroup = new Node\AttributeGroup([
106 new Node\Attribute(new Node\Name('A'), []),
108 $attrGroup2 = new Node\AttributeGroup([
109 new Node\Attribute(new Node\Name('B'), []),
150 new #[A] class {};
[all …]
H A Darray_spread.test9 $array->items[] = new Expr\ArrayItem(new Expr\Variable('b'));
23 $array->items[] = new Expr\ArrayItem(new Expr\Variable('c'), null, false, [], true);
H A DlistInsertionIndentation.test4 $this->foo = new Foo;
12 $stmts[2] = new Stmt\Expression(new Expr\MethodCall($var, $outerCall->name));
15 $this->foo = new Foo;
H A DblockConversion.test9 $stmts[0]->stmts[] = new Stmt\Expression(new Expr\Variable('c'));
23 $stmts[0]->stmts[] = new Stmt\Expression(new Expr\Variable('c'));
H A Dgroup_use.test6 $stmts[0] = new Stmt\Use_([new Node\UseItem(new Node\Name('A\B'))]);
H A Denum.test31 $stmts[0]->scalarType = new Node\Identifier('int');
42 $stmts[0]->scalarType = new Node\Identifier('int');
55 $stmts[0]->stmts[0]->expr = new Scalar\LNumber(1);
70 $stmts[0]->stmts[] = new Node\Stmt\EnumCase('C');
85 $stmts[0]->implements[] = new Node\Name('Z');
96 $stmts[0]->implements[] = new Node\Name('Y');
/PHP-Parser/lib/PhpParser/Internal/
H A DDiffer.php31 * @param T[] $new New array
35 public function diff(array $old, array $new): array { argument
37 $new = \array_values($new);
38 list($trace, $x, $y) = $this->calculateTrace($old, $new);
39 return $this->extractDiff($trace, $x, $y, $old, $new);
49 * @param T[] $new New array
54 return $this->coalesceReplacements($this->diff($old, $new));
59 * @param T[] $new
62 private function calculateTrace(array $old, array $new): array { argument
64 $m = \count($new);
[all …]
H A DDiffElem.php19 public $new; variable in PhpParser\\Internal\\DiffElem
24 * @param mixed $new Is null for remove operations
26 public function __construct(int $type, $old, $new) { argument
29 $this->new = $new;
/PHP-Parser/test/code/parser/expr/
H A Dnew.test5 new A;
6 new A($b);
9 new $a();
10 new $a['b']();
11 new A::$b();
13 new $a->b();
14 new $a->b->c();
15 new $a->b['c']();
17 // test regression introduces by new dereferencing syntax
18 (new A);
[all …]
H A DnewDeref.test5 new A()->foo;
6 new A()->foo();
7 new A()::FOO;
8 new A()::foo();
9 new A()::$foo;
10 new A()[0];
11 new A()();
13 new class {}->foo;
15 new class {}::FOO;
18 new class {}[0];
[all …]
H A DassignNewByRef.test1 Assigning new by reference (PHP 5 only)
4 $a =& new B;
25 $a =& new B;
28 Cannot assign new by reference from 2:1 to 2:11
/PHP-Parser/test/code/parser/expr/uvs/
H A Dnew.test1 UVS new expressions
4 new $className;
5 new $array['className'];
6 new $obj->className;
7 new Test::$className;
8 new $test::$className;
9 new $weird[0]->foo::$className;
/PHP-Parser/
H A DCONTRIBUTING.md15 ## Adding support for new PHP syntax
17 1. If necessary, add emulation support for new tokens.
18 * Add a new subclass of `Lexer\TokenEmulator`. Take inspiration from existing classes.
19 * Add the new class to the array in `Lexer\Emulative`.
21 `provideTestReplaceKeywords()` for new reserved keywords and `provideTestLexNewFeatures()` for
23 2. Add any new node classes that are needed.
24 3. Add support for the new syntax in `grammar/php.y`. Regenerate the parser by running
30 7. Does the new syntax feature namespaced names? If so, add support for name resolution in
32 8. Does the new syntax require any changes to builders? Is so, make them :)

Completed in 46 milliseconds

123