mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 23:28:15 +01:00
Replace string by class call (#477)
For better PHP-Scoper compatibility
This commit is contained in:
parent
08215e7646
commit
1c3eabb000
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
|
use PhpParser\Node;
|
||||||
|
|
||||||
abstract class NodeAbstract implements Node, \JsonSerializable
|
abstract class NodeAbstract implements Node, \JsonSerializable
|
||||||
{
|
{
|
||||||
protected $attributes;
|
protected $attributes;
|
||||||
@ -23,10 +25,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable
|
|||||||
public function getType() {
|
public function getType() {
|
||||||
$className = rtrim(get_class($this), '_');
|
$className = rtrim(get_class($this), '_');
|
||||||
return strtr(
|
return strtr(
|
||||||
substr(
|
substr($className, strlen(Node::class) + 1),
|
||||||
$className,
|
|
||||||
strpos($className, 'PhpParser\Node') + 15
|
|
||||||
),
|
|
||||||
'\\',
|
'\\',
|
||||||
'_'
|
'_'
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user