1.2.1163. Strange Name For Variables

Variables with strange names. They might be a typo, or bear strange patterns.

Any variable with three identical letter in a row are considered as strange. 2 letters in a row is classic, and while three letters may happen, it is rare enough.

A list of classic typo is also used to find such variables.

This analysis is case-sensitive.

<?php

class foo {
    function bar() {
        // Strange name $tihs
        return $tihs;
    }

    function barbar() {
        // variables with blocks of 3 times the same character are reported
        // Based on Alexandre Joly's tweet
        $aaa = $bab + $www;
    }
}

?>

See also #QuandLeDevALaFleme.

1.2.1163.1. Connex PHP features

1.2.1163.1.1. Suggestions

  • Fix the name of the variable

  • Rename the variable to something better

  • Drop the variable

1.2.1163.1.2. Specs

Short name

Variables/StrangeName

Rulesets

All, Changed Behavior, Semantics

Exakat since

0.10.5

PHP Version

All

Severity

Minor

Time To Fix

Slow (1 hour)

Precision

High

Examples

FuelCMS, PhpIPAM

Available in

Entreprise Edition, Exakat Cloud