1.2.487. Fully Qualified Constants¶
Constants defined with their namespace.
When defining constants with define() function, it is possible to include the actual namespace : However, the name should be fully qualified without the initial . Here, abc constant will never be accessible as a namespace constant, though it will be accessible via the constant() function.
Also, the namespace will be absolute, and not a relative namespace of the current one.
<?php
define('a\b\c', 1);
?>
1.2.487.1. Connex PHP features¶
1.2.487.1.1. Suggestions¶
Drop the initial when creating constants with define() : for example, use trim($x, ‘'), which removes anti-slashes before and after.
1.2.487.1.2. Specs¶
Short name |
Namespaces/ConstantFullyQualified |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |