Phan\Debug::nodeName PHP Method

nodeName() public static method

public static nodeName ( $node ) : string
return string The name of the node
    public static function nodeName($node) : string
    {
        if (is_string($node)) {
            return 'string';
        }
        if (!$node) {
            return 'null';
        }
        return \ast\get_kind_name($node->kind);
    }

Usage Example

Example #1
0
 /**
  * Default visitor for node kinds that do not have
  * an overriding method
  *
  * @param Node $node
  * A node to parse
  *
  * @return Context
  * A new or an unchanged context resulting from
  * parsing the node
  */
 public function visit(Node $node) : Context
 {
     assert(false, "Unknown left side of assignment in {$this->context} with node type " . Debug::nodeName($node));
     return $this->visitVar($node);
 }