PHPSA\Analyzer\Pass\Statement\MissingBreakStatement::pass PHP Method

pass() public method

public pass ( PhpParser\Node\Stmt\Switch_ $switchStmt, Context $context ) : boolean
$switchStmt PhpParser\Node\Stmt\Switch_
$context PHPSA\Context
return boolean
    public function pass(Stmt\Switch_ $switchStmt, Context $context)
    {
        $result = false;
        $caseStmts = $switchStmt->cases;
        if (count($caseStmts) < 2) {
            return $result;
        }
        array_pop($caseStmts);
        // the last case statement CAN have no "break" or "return"
        /** @var Stmt\Case_ $case */
        foreach ($caseStmts as $case) {
            $result = $this->checkCaseStatement($case, $context) || $result;
        }
        return $result;
    }