public function enterNode(Node $node): ?int
    {
        switch (get_class($node)) {
            case Namespace_::class:
                $this->resetState('\\' . $node->name . '\\');
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case Class_::class:
            case Trait_::class:
            case Interface_::class:
                if (empty($node->name)) {
                    return NodeTraverser::DONT_TRAVERSE_CHILDREN;
                }

                $this->parts->push((string)$node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case Function_::class:
                $this->parts->push($node->name . '()');
                $node->fqsen = new Fqsen($this->buildName());
                return NodeTraverser::DONT_TRAVERSE_CHILDREN;
            case ClassMethod::class:
                $this->parts->push('::' . $node->name . '()');
                $node->fqsen = new Fqsen($this->buildName());
                return NodeTraverser::DONT_TRAVERSE_CHILDREN;
            case ClassConst::class:
                $this->parts->push('::');
                break;
            case Const_::class:
                $this->parts->push($node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case PropertyProperty::class:
                $this->parts->push('::$' . $node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
        }

        return null;
    }
public function enterNode(Node $node): ?int
    {
        switch (get_class($node)) {
            case Namespace_::class:
                $this->resetState('\\' . $node->name . '\\');
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case Class_::class:
            case Trait_::class:
            case Interface_::class:
                if (empty($node->name)) {
                    return NodeTraverser::DONT_TRAVERSE_CHILDREN;
                }

                $this->parts->push((string)$node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case Function_::class:
                $this->parts->push($node->name . '()');
                $node->fqsen = new Fqsen($this->buildName());
                return NodeTraverser::DONT_TRAVERSE_CHILDREN;
            case ClassMethod::class:
                $this->parts->push('::' . $node->name . '()');
                $node->fqsen = new Fqsen($this->buildName());
                return NodeTraverser::DONT_TRAVERSE_CHILDREN;
            case ClassConst::class:
                $this->parts->push('::');
                break;
            case Const_::class:
                $this->parts->push($node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
            case PropertyProperty::class:
                $this->parts->push('::$' . $node->name);
                $node->fqsen = new Fqsen($this->buildName());
                break;
        }

        return null;
    }
public function enterNode ( Node $ node ) : ? int { switch ( get_class ( $ node ) ) { case Namespace_ :: class : $ this -> resetState ( '\\' . $ node -> name . '\\' ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; break ; case Class_ :: class : case Trait_ :: class : case Interface_ :: class : if ( empty ( $ node -> name ) ) { return NodeTraverser :: DONT_TRAVERSE_CHILDREN ; } $ this -> parts -> push ( ( string ) $ node -> name ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; break ; case Function_ :: class : $ this -> parts -> push ( $ node -> name . '()' ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; return NodeTraverser :: DONT_TRAVERSE_CHILDREN ; case ClassMethod :: class : $ this -> parts -> push ( '::' . $ node -> name . '()' ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; return NodeTraverser :: DONT_TRAVERSE_CHILDREN ; case ClassConst :: class : $ this -> parts -> push ( '::' ) ; break ; case Const_ :: class : $ this -> parts -> push ( $ node -> name ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; break ; case PropertyProperty :: class : $ this -> parts -> push ( '::$' . $ node -> name ) ; $ node -> fqsen = new Fqsen ( $ this -> buildName ( ) ) ; break ; } return null ; }
Adds fqsen property to a node when applicable.

@todo this method is decorating the Node with an $fqsen property...
since we can't declare it in PhpParser/NodeAbstract,
we should add a decorator class wrapper in Reflection...
that should clear up the PHPSTAN errors about
"access to an undefined property ::$fqsen".
Adds fqsen property to a node when applicable .