1.2.531. Hidden Use Expression¶
The use expression for namespaces should always be at the beginning of the namespace block.
It is where everyone expect them, and it is less confusing than having them at various levels.
<?php
// This is visible
use A;
class B {}
// This is hidden
use C as D;
class E extends D {
use traitT; // This is a use for a trait
function foo() {
// This is a use for a closure
return function ($a) use ($b) {}
}
}
?>
1.2.531.1. Connex PHP features¶
1.2.531.1.1. Suggestions¶
Group all uses together, at the beginning of the namespace or class
1.2.531.1.2. Specs¶
Short name |
Namespaces/HiddenUse |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
High |
Examples |
|
Available in |