mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 09:27:58 +01:00
4abc531213
The trailing newline is no longer part of the comment token.
77 lines
1.3 KiB
Plaintext
77 lines
1.3 KiB
Plaintext
Adding statement to Class Method containing Nop
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
// I'm just a comment
|
|
}
|
|
}
|
|
-----
|
|
$stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
// I'm just a comment
|
|
$foo;
|
|
}
|
|
}
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
/* I'm just a comment */
|
|
}
|
|
}
|
|
-----
|
|
$stmts[0]->stmts[0]->stmts[] = new Stmt\Expression(new Node\Expr\Variable('foo'));
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
/* I'm just a comment */
|
|
$foo;
|
|
}
|
|
}
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
/* I'm just a comment */
|
|
}
|
|
}
|
|
-----
|
|
$stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("/* I'm a new comment */")]);
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
/* I'm a new comment */
|
|
|
|
}
|
|
}
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
// I'm just a comment
|
|
}
|
|
}
|
|
-----
|
|
$stmts[0]->stmts[0]->stmts[0]->setAttribute('comments', [new Comment("// I'm a new comment\n")]);
|
|
-----
|
|
<?php
|
|
class Foo {
|
|
public function __construct()
|
|
{
|
|
// I'm a new comment
|
|
|
|
}
|
|
} |