1.2.1285. Unused Constants

Those constants are defined in the code but never used. Defining unused constants slow down the application, as they are executed and stored in PHP hashtables.

It is recommended to comment them out, and only define them when it is necessary.

<?php

// const-defined constant
const USED_CONSTANT  = 0;
const UNUSED_CONSTANT = 1 + USED_CONSTANT;

// define-defined constant
define('ANOTHER_UNUSED_CONSTANT', 3);

?>

1.2.1285.1. Suggestions

  • Make use of the constant

  • Remove the constant

1.2.1285.2. Specs

Short name

Constants/UnusedConstants

Rulesets

All, Changed Behavior, Dead code

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Instant (5 mins)

Precision

High

Features

constant

Available in

Entreprise Edition, Exakat Cloud