classBranchArms
final class BranchArms
The runs of statements a branching statement can take.
An if, a switch and a try each run one of several lists of statements. Each list is one arm; an arm that cannot fall through to the next statement is left out, since it cannot be the one taken on the way to anything after it.
Methods§
public function of(Stmt $statement): list<list<Stmt>>|nullThe runs of statements a branching statement may have taken, or null when it does not branch.
An arm that cannot finish — it returns, throws, breaks or continues — cannot have been the one taken on the way to a statement after it, so only the arms that fall through are kept.
Parameters
$statement | Stmt |
Returns
list<list<Stmt>>|nullTest cases 2
Called from 1
Calls 6
- method-call BranchArms::ifArms() line 33
- method-call BranchArms::switchArms() line 34
- method-call BranchArms::tryArms() line 35
- function-call
array_valuesline 41 - function-call
array_filterline 41 - method-call BranchArms::completes() line 41
public function ifArms(If_ $statement): list<list<Stmt>>The arms of a conditional, with the empty arm taken when no condition holds.
Parameters
$statement | If_ |
Returns
list<list<Stmt>>Test cases 1
Called from 1
Calls 1
- function-call
array_valuesline 53
public function switchArms(Switch_ $statement): list<list<Stmt>>The arms of a switch, each without the break that ends it.
Parameters
$statement | Switch_ |
Returns
list<list<Stmt>>Test cases 2
Called from 1
public function tryArms(TryCatch $statement): list<list<Stmt>>The runs of a try statement: the try block, or one of its handlers, each followed by the finally block.
Parameters
$statement | TryCatch |
Returns
list<list<Stmt>>Test cases 1
Called from 1
public function completes(list<Stmt> $statements): boolWhether a run of statements can finish and let the next statement run.
Parameters
$statements | list<Stmt> |
Returns
boolTest cases 2
Called from 1
Calls 1
- function-call
countline 107
Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
BranchArmsTest::testCompletesIsFalseForARunEndingInABreakOrAContinuecallsBranchArmsTest::testCompletesSaysWhetherTheNextStatementCanRuncallsBranchArmsTest::testIfArmsIncludeTheArmTakenWhenNoConditionHoldscallsBranchArmsTest::testOfKeepsEveryArmWhenNoneFallsThroughcallsBranchArmsTest::testOfKeepsOnlyTheArmsThatFallThroughcallsBranchArmsTest::testSwitchArmsDropTheirBreakAndAddTheArmTakenWhenNoCaseMatchescallsBranchArmsTest::testSwitchArmsWithADefaultHaveNoEmptyArmcallsBranchArmsTest::testTryArmsFollowEachWayOutWithTheFinallyBlockcalls
Other tests reaching this symbol 6
CalleeReturnsTestcallsDeriverTestcallsBackwardSlicerTestcallsLoopPassesTestcallsInterpreterTestcallsAnalyzerTestcalls