namespace PhpParser;
+use PhpParser\Node;
+
abstract class NodeAbstract implements Node, \JsonSerializable
{
protected $attributes;
* @return string Type of the node
*/
public function getType() {
- return strtr(substr(rtrim(get_class($this), '_'), 15), '\\', '_');
+ $className = rtrim(get_class($this), '_');
+ return strtr(
+ substr($className, strlen(Node::class) + 1),
+ '\\',
+ '_'
+ );
}
/**
* Sets line the node started in.
*
* @param int $line Line
+ *
+ * @deprecated
*/
public function setLine($line) {
$this->setAttribute('startLine', (int) $line);