Replace string by class call (#477)

For better PHP-Scoper compatibility
This commit is contained in:
Théo FIDRY 2018-02-23 21:44:40 +00:00 committed by Nikita Popov
parent 08215e7646
commit 1c3eabb000

View File

@ -2,6 +2,8 @@
namespace PhpParser;
use PhpParser\Node;
abstract class NodeAbstract implements Node, \JsonSerializable
{
protected $attributes;
@ -23,10 +25,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable
public function getType() {
$className = rtrim(get_class($this), '_');
return strtr(
substr(
$className,
strpos($className, 'PhpParser\Node') + 15
),
substr($className, strlen(Node::class) + 1),
'\\',
'_'
);