1.2.1416. Variable Is A Local Constant

A variable that is written once, then never modified : it behaves like a constant. Some other rule may take advantage of this.

<?php

function foo() {
    $localConstant = 'Hello';
    echo $localConstant;

    $variable = 'Hello, ';
    $variable .= date('r');
    echo $variable;
}

?>

1.2.1416.1. Specs

Short name

Variables/IsLocalConstant

Rulesets

All, Changed Behavior, First, NoDoc

Exakat since

2.3.3

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud