1.2.223. Constant : With Or Without Use¶
This analysis collects the ways constants are called in the code : with a local import, alias or not, or with their fully qualified name.
The analyzed code has less than 10% of one of them : for consistency reasons, it is recommended to make them all the same.
<?php
use const AA as BB;
// This is the fully qualified name.
echo \AA;
// If this is used 10 times or more, then it is the standard.
echo BB;
?>
1.2.223.1. Connex PHP features¶
1.2.223.1.1. Specs¶
Short name |
Namespaces/ConstantWithUseFavorite |
Rulesets |
|
Exakat since |
2.3.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |