I\'d like to reuse a functionality several times in a single class. This functionality relies on a private variable:
tr
I confirmed that you can alias the same function multiple times, which was a surprise to me. Although ZendStudio appears to only 'code assist' on the last alias of the function.
Being able to alias the same function multiple times could lend itself to some interesting behavior if the Trait function can determine what name it was called as. But it does not appear that we can determined the 'aliased' function within a trait function.
Here's my test code:
test1();
$c->test2();
Output:
TestClass, TestTrait, TestTrait::test, test
TestClass, TestTrait, TestTrait::test, test
Perhaps it would be nice to add a new __ALIAS__
constant for trait functions to determine what alias they were called as.
In fact I have created PHP feature request for this:
https://bugs.php.net/bug.php?id=63629