num === null) { return null; } if ($node->num instanceof LNumber) { $number = $this->getValue($node->num); if ($number > 1) { return null; } if ($number === 0) { $node->num = null; return $node; } return null; } if ($node->num instanceof Variable) { return $this->processVariableNum($node, $node->num); } return null; } /** * @param Break_|Continue_ $node */ private function processVariableNum(Node $node, Variable $numVariable): ?Node { $staticType = $this->getStaticType($numVariable); if ($staticType instanceof ConstantType) { if ($staticType instanceof ConstantIntegerType) { if ($staticType->getValue() === 0) { $node->num = null; return $node; } if ($staticType->getValue() > 0) { $node->num = new LNumber($staticType->getValue()); return $node; } } return $node; } // remove variable $node->num = null; return null; } }