1.2.80. Bad Constants Names¶
PHP’s manual recommends that developer do not use constants with the convention __NAME__
. Those are reserved for PHP future use.
For example, __TRAIT__
recently appeared in PHP, as a magic constant. In the future, other may appear.
The analyzer reports any constant which name is __.*.__
, or even _.*_
(only one underscore).
<?php
const __MY_APP_CONST__ = 1;
const __MY_APP_CONST__ = 1;
define('__MY_OTHER_APP_CONST__', 2);
?>
See also Constants.
1.2.80.1. Connex PHP features¶
1.2.80.1.1. Suggestions¶
Avoid using names that doesn’t comply with PHP’s convention
1.2.80.1.2. Specs¶
Short name |
Constants/BadConstantnames |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Examples |
|
Available in |