1.2.161. Collect Block Size

Collect block size for instructions such as for, foreach, while, do…while, ifthen.

This is a starting point for reviewing large blocks of code and extract methods.

<?php

foreach($array as $key => $value) {
     // This is a one line block for the foreach
     doSomething();
}

if($a === $b) {
     $a++;
     // This is a two lines block for the ifthen
     doSomething($a, $b);
}

?>

1.2.161.1. Specs

Short name

Dump/CollectBlockSize

Rulesets

All, Dump

Exakat since

2.2.0

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

inclusion, ifthen, foreach, while, dowhile

Available in

Entreprise Edition, Exakat Cloud