private function tryRemoveDeadAssignments(NodeTraversal $t, ControlFlowGraph $cfg)
 {
     $nodes = $cfg->getDirectedGraphNodes();
     foreach ($nodes as $cfgNode) {
         $inState = $cfgNode->getAttribute(DataFlowAnalysis::ATTR_FLOW_STATE_IN);
         $outState = $cfgNode->getAttribute(DataFlowAnalysis::ATTR_FLOW_STATE_OUT);
         $n = $cfgNode->getAstNode();
         if (null === $n) {
             continue;
         }
         switch (true) {
             case $n instanceof \PHPParser_Node_Stmt_If:
             case $n instanceof \PHPParser_Node_Stmt_ElseIf:
             case $n instanceof \PHPParser_Node_Stmt_While:
             case $n instanceof \PHPParser_Node_Stmt_Do:
             case $n instanceof \PHPParser_Node_Stmt_For:
             case $n instanceof \PHPParser_Node_Stmt_Switch:
             case $n instanceof \PHPParser_Node_Stmt_Case:
                 if (null !== ($condition = NodeUtil::getConditionExpression($n))) {
                     $this->tryRemoveAssignment($t, $condition, null, $inState, $outState);
                 }
                 continue 2;
             case $n instanceof \PHPParser_Node_Stmt_Return:
                 if (null !== $n->expr) {
                     $this->tryRemoveAssignment($t, $n->expr, null, $inState, $outState);
                 }
                 continue 2;
         }
         $this->tryRemoveAssignment($t, $n, null, $inState, $outState);
     }
 }