You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's an example:
Say the $cb function is analysing an if statement. All nodes in the $node->stmts will be evaluated, but these are only the statements in the true branch. Thus, the else branch and elseif branches are ignored.
Hi,
I've noticed PhpMetrics does not correctly report cyclomatic complexity and max method cyclomatic complexity.
The bug is due to CyclomaticComplexityVisitor::leaveNode(), line 61 not taking into account else branches, elseif branches and ternary operators in control statement conditions.
Here's an example:
Say the
$cb
function is analysing anif
statement. All nodes in the$node->stmts
will be evaluated, but these are only the statements in thetrue
branch. Thus, theelse
branch andelseif
branches are ignored.I will make a PR with a fix shortly.Here.The text was updated successfully, but these errors were encountered: