Avoid having variable with a too short name (PHP) | CAST Appmarq

Avoid having variable with a too short name (PHP)


Rule Definition
Source code containing short variable names is difficult to read and therefore to maintain.

Remediation
Modify the source code to reduce the number of the artifacts with variable names that are too short.

Violation Code Sample
class CastTest
{ 
 private $b = 20; // VIOLATION - Field 
 
 public static function main( array $as ) { // VIOLATION - Formal 
  $a = 20 + $this-> b; // VIOLATION - Local 
  for (int $i = 0; $i < 10; $i++) 
   { // Not a Violation (inside FOR)  
    $a += $this-> 
   } 
  } 
}

Reference
PHPMD http://phpmd.org/rules/naming.html#shortvariable

Related Technologies

Health Factor

  Total Quality Index


Technical Criterion
Documentation - Naming Convention Conformity

About CAST Appmarq

CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.

Benchmark Statistics

Global Compliance

98.46%

Total Violations
5,047
Total Opportunities
328,363
Average Violations / App.
88.54
The compliance score represents 1 minus the ratio between the number of times a rule has been violated compared to the number of opportunities in a set of applications that the rule could have been violated.

Industry Insights

Select from drop-down

96.62%

IT & Business Consulting

97.60%

Telecommunications

95.65%