From 1c3eabb0005cc0a42c9fa6cf977e8383a08ab75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 23 Feb 2018 21:44:40 +0000 Subject: [PATCH] Replace string by class call (#477) For better PHP-Scoper compatibility --- lib/PhpParser/NodeAbstract.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/PhpParser/NodeAbstract.php b/lib/PhpParser/NodeAbstract.php index 11671d4..1b757c7 100644 --- a/lib/PhpParser/NodeAbstract.php +++ b/lib/PhpParser/NodeAbstract.php @@ -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), '\\', '_' );