public function leaveNode(Node $node)
{
switch (true) {
case $node instanceof Node\Stmt\Namespace_:
$this->namespace = null;
break;
case $node instanceof Node\Stmt\Class_:
$this->class = null;
break;
case $node instanceof Node\Stmt\Trait_:
$this->trait = null;
break;
case $node instanceof Node\Stmt\Function_:
case $node instanceof Node\Stmt\ClassMethod:
$this->function = null;
break;
case $node instanceof Node\Expr\Closure:
$this->closureNestingLevel--;
break;
default:
break;
}
}