1.2.1326. Use Const And Functions¶
Since PHP 5.6 it is possible to import specific functions or constants from other namespaces.
<?php
namespace A {
const X = 1;
function foo() { echo __FUNCTION__; }
}
namespace My{
use function A\foo;
use constant A\X;
echo foo(X);
}
?>
See also Using namespaces: Aliasing/Importing.
1.2.1326.1. Specs¶
Short name |
Namespaces/UseFunctionsConstants |
Rulesets |
All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55 |
Exakat since |
0.8.4 |
PHP Version |
With PHP 5.6 and more recent |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |