1.2.237. Constants Usage

List of constants in use in the source code. Constants are T_STRING, localised in specific part of the code.

For example, they can’t be followed by a parenthesis, as this is a function call; nor preceded by a new operator, as this is an object instantiation.

<?php

const MY_CONST = 'Hello';

// PHP_EOL (native PHP Constant)
// MY_CONST (custom constant)
echo PHP_EOL . MY_CONST;

// Here, MY_CONST is actually a function name, and is omitted in this analysis
MY_CONST();

?>

1.2.237.1. Specs

Short name

Constants/ConstantUsage

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

constant

Available in

Entreprise Edition, Community Edition, Exakat Cloud