mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 09:27:58 +01:00
Declare namespacedName property
For historical reasons, this property is used by the NameResolver (in default mode). Declare it explicitly, rather than using a doc comment.
This commit is contained in:
parent
d4cb98ae38
commit
f09f22760e
@ -4,9 +4,6 @@ namespace PhpParser\Node;
|
|||||||
|
|
||||||
use PhpParser\NodeAbstract;
|
use PhpParser\NodeAbstract;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property Name $namespacedName Namespaced name (for global constants, if using NameResolver)
|
|
||||||
*/
|
|
||||||
class Const_ extends NodeAbstract
|
class Const_ extends NodeAbstract
|
||||||
{
|
{
|
||||||
/** @var Identifier Name */
|
/** @var Identifier Name */
|
||||||
@ -14,6 +11,9 @@ class Const_ extends NodeAbstract
|
|||||||
/** @var Expr Value */
|
/** @var Expr Value */
|
||||||
public $value;
|
public $value;
|
||||||
|
|
||||||
|
/** @var Name Namespaced name (if using NameResolver) */
|
||||||
|
public $namespacedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a const node for use in class const and const statements.
|
* Constructs a const node for use in class const and const statements.
|
||||||
*
|
*
|
||||||
|
@ -4,9 +4,6 @@ namespace PhpParser\Node\Stmt;
|
|||||||
|
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property Node\Name $namespacedName Namespaced name (if using NameResolver)
|
|
||||||
*/
|
|
||||||
abstract class ClassLike extends Node\Stmt
|
abstract class ClassLike extends Node\Stmt
|
||||||
{
|
{
|
||||||
/** @var Node\Identifier|null Name */
|
/** @var Node\Identifier|null Name */
|
||||||
@ -16,6 +13,9 @@ abstract class ClassLike extends Node\Stmt
|
|||||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||||
public $attrGroups;
|
public $attrGroups;
|
||||||
|
|
||||||
|
/** @var Node\Name Namespaced name (if using NameResolver) */
|
||||||
|
public $namespacedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TraitUse[]
|
* @return TraitUse[]
|
||||||
*/
|
*/
|
||||||
|
@ -5,9 +5,6 @@ namespace PhpParser\Node\Stmt;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\FunctionLike;
|
use PhpParser\Node\FunctionLike;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property Node\Name $namespacedName Namespaced name (if using NameResolver)
|
|
||||||
*/
|
|
||||||
class Function_ extends Node\Stmt implements FunctionLike
|
class Function_ extends Node\Stmt implements FunctionLike
|
||||||
{
|
{
|
||||||
/** @var bool Whether function returns by reference */
|
/** @var bool Whether function returns by reference */
|
||||||
@ -23,6 +20,9 @@ class Function_ extends Node\Stmt implements FunctionLike
|
|||||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||||
public $attrGroups;
|
public $attrGroups;
|
||||||
|
|
||||||
|
/** @var Node\Name Namespaced name (if using NameResolver) */
|
||||||
|
public $namespacedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a function node.
|
* Constructs a function node.
|
||||||
*
|
*
|
||||||
|
@ -306,6 +306,7 @@ PHP;
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attrGroups": [],
|
"attrGroups": [],
|
||||||
|
"namespacedName": null,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"startLine": 4,
|
"startLine": 4,
|
||||||
"comments": [
|
"comments": [
|
||||||
@ -454,7 +455,8 @@ JSON;
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attrGroups": []
|
"attrGroups": [],
|
||||||
|
"namespacedName": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
JSON;
|
JSON;
|
||||||
|
@ -353,7 +353,7 @@ EOC;
|
|||||||
$this->assertSame('NS\\C', (string) $stmts[0]->stmts[2]->namespacedName);
|
$this->assertSame('NS\\C', (string) $stmts[0]->stmts[2]->namespacedName);
|
||||||
$this->assertSame('NS\\D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName);
|
$this->assertSame('NS\\D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName);
|
||||||
$this->assertSame('NS\\E', (string) $stmts[0]->stmts[4]->namespacedName);
|
$this->assertSame('NS\\E', (string) $stmts[0]->stmts[4]->namespacedName);
|
||||||
$this->assertObjectNotHasAttribute('namespacedName', $stmts[0]->stmts[5]->class);
|
$this->assertNull($stmts[0]->stmts[5]->class->namespacedName);
|
||||||
$this->assertSame('NS\\F', (string) $stmts[0]->stmts[6]->namespacedName);
|
$this->assertSame('NS\\F', (string) $stmts[0]->stmts[6]->namespacedName);
|
||||||
|
|
||||||
$stmts = $traverser->traverse([new Stmt\Namespace_(null, $nsStmts)]);
|
$stmts = $traverser->traverse([new Stmt\Namespace_(null, $nsStmts)]);
|
||||||
@ -362,7 +362,7 @@ EOC;
|
|||||||
$this->assertSame('C', (string) $stmts[0]->stmts[2]->namespacedName);
|
$this->assertSame('C', (string) $stmts[0]->stmts[2]->namespacedName);
|
||||||
$this->assertSame('D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName);
|
$this->assertSame('D', (string) $stmts[0]->stmts[3]->consts[0]->namespacedName);
|
||||||
$this->assertSame('E', (string) $stmts[0]->stmts[4]->namespacedName);
|
$this->assertSame('E', (string) $stmts[0]->stmts[4]->namespacedName);
|
||||||
$this->assertObjectNotHasAttribute('namespacedName', $stmts[0]->stmts[5]->class);
|
$this->assertNull($stmts[0]->stmts[5]->class->namespacedName);
|
||||||
$this->assertSame('F', (string) $stmts[0]->stmts[6]->namespacedName);
|
$this->assertSame('F', (string) $stmts[0]->stmts[6]->namespacedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user