1.2.235. Constant Used Only Once

This rule reports constants that are used only once. Constants that are used only once may be replaced by they literal value, unless future use is expected.

This rule works on global and class constants.

<?php

const ONCE = 1;

echo ONCE;

?>

1.2.235.1. Connex PHP features

1.2.235.1.1. Suggestions

  • Use the constant more than once.

  • Replace the constant with a literal value.

1.2.235.1.2. Specs

Short name

Constants/ConstantUsedOnce

Rulesets

All, Analyze, Changed Behavior

Exakat since

2.6.7

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud