PHP use and namespaces

Hi,
In PHP you can do something like:
Currently there is a force namespace prefix but I can't find a way to use it this way, it's quite demanding to add the uses you need to artifacts manually.
So the feature request would be that the current "import" dependency generates a PHP use statement at least so you can use the alias "SomeClass" instead of "\SomeNamespace\SomeClass", I don't know how to solve the "SVLAC" alias case.
And for the methods like "someNiceMethod" to generate a PHP use statement automatically and use it when the force namespace prefix is not set (for example).
These features would be very useful for big projects with a lot of namespaces!
Thanks,
Federico.
In PHP you can do something like:
- Code: Select all
<?php
namespace Test;
use \SomeNamespace\SomeClass;
use \SomeVeryLargeAnoyingNamespace\SomeVeryLargeAnoyingClass as SVLAC;
class Test {
public function dependency() {
$s = new SomeClass;
$svlac = new SVLAC;
$svlac2 = new \SomeVeryLargeAnoyingNamespace\SomeVeryLargeAnoyingClass();
}
public function someNiceMethod(SVLAC $hello) {
// something php 7 friendly
}
/**
* @param SVLAC $hello some hi hi. (@param ${t0} ${p0} ...)
*/
public function someNiceMethodUntyped($hello) {
// something php 5 friendly
}
/**
* @param SVLAC $hello some hi hi. (@param ${t0} ${p0} ...)
* @return SVLAC (${type})
*/
public function someNiceMethodReturning(SVLAC $hello) : SVLAC {
// something php 7.1 friendly
return $hello;
}
/**
* @param \SomeVeryLargeAnoyingNamespace\SomeVeryLargeAnoyingClass $hello Some hello thing
*/
public function someUglyMethod(\SomeVeryLargeAnoyingNamespace\SomeVeryLargeAnoyingClass $hello) {
// something else
}
}
Currently there is a force namespace prefix but I can't find a way to use it this way, it's quite demanding to add the uses you need to artifacts manually.
So the feature request would be that the current "import" dependency generates a PHP use statement at least so you can use the alias "SomeClass" instead of "\SomeNamespace\SomeClass", I don't know how to solve the "SVLAC" alias case.
And for the methods like "someNiceMethod" to generate a PHP use statement automatically and use it when the force namespace prefix is not set (for example).
These features would be very useful for big projects with a lot of namespaces!
Thanks,
Federico.