Transphpile\Transpile\NodeStateStack::getInstance PHP Method

getInstance() public static method

We can only reach the nodeStackState class through a ::getInstance() call.
public static getInstance ( ) : NodeStateStack
return NodeStateStack
    public static function getInstance()
    {
        if (static::$instance == null) {
            static::$instance = new NodeStateStack();
            static::$instance->pushVars();
        }
        return static::$instance;
    }

Usage Example

 /**
  * @param array $nodes
  * @return \PhpParser\Node[]
  */
 public function traverse(array $nodes)
 {
     NodeStateStack::getInstance()->pushVars();
     $ret = parent::traverse($nodes);
     NodeStateStack::getInstance()->popVars();
     return $ret;
 }
All Usage Examples Of Transphpile\Transpile\NodeStateStack::getInstance