1.2.512. Group Use Declaration¶
This rule reports when a group use declaration is used. This is PHP feature since version 7.0, yet it is seldom used.
<?php
// Adapted from the RFC documentation
// Pre PHP 7 code
use some\name_space\ClassA;
use some\name_space\ClassB;
use some\name_space\ClassC as C;
use function some\name_space\fn_a;
use function some\name_space\fn_b;
use function some\name_space\fn_c;
use const some\name_space\ConstA;
use const some\name_space\ConstB;
use const some\name_space\ConstC;
// PHP 7+ code
use some\name_space\{ClassA, ClassB, ClassC as C};
use function some\name_space\{fn_a, fn_b, fn_c};
use const some\name_space\{ConstA, ConstB, ConstC};
?>
See also Group Use Declaration RFC and Using namespaces: Aliasing/Importing.
1.2.512.1. Connex PHP features¶
1.2.512.1.1. Specs¶
Short name |
Php/GroupUseDeclaration |
Rulesets |
All, Appinfo, CE, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56 |
Exakat since |
0.10.7 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Available in |