1.2.222. Constant Case Preference

Define() creates constants which are case sensitive or not.

The analyzed code has less than 10% of one of them : for consistency reasons, it is recommended to make constant sensitivity definition consistent.

Note that define() used to allow the creation of case-sensitive constants, but this is deprecated since PHP 7.3 and will be removed in PHP 8.0.

<?php

    define('A1', 1);
    define('A2', 1);
    define('A3', 1);
    define('A4', 1);
    define('A5', 1);
    define('A6', 1);
    define('A7', 1);
    define('A8', 1);
    define('A9', 1);
    define('A10',1);

    define('A10',1, true);

?>

See also PHP Constants and Constant definition.

1.2.222.1. Specs

Short name

Constants/DefineInsensitivePreference

Rulesets

All, Changed Behavior, Preferences

Exakat since

1.3.8

PHP Version

With PHP 7.0 and older

Severity

Time To Fix

Precision

Very high

Features

constant

Available in

Entreprise Edition, Exakat Cloud