Hi,
Is this intended not being able to give a new name to a method even in
case of no conflict?
In the following example, I try to provide the name "sayIt"
additionally to "saySomething" from trait "Hello":
<?php
trait Hello {
public function saySomething() {
echo 'Hello';
}
}
class MyHello{
use Hello {
Hello::saySomething as sayIt;
}
}
?>
The following error message is shown while running it:
Fatal error: Failed to add aliased trait method (sayIt) to the trait
table. There is probably already a trait method with the same name in
%s on line %d
The error message might be misleading even if it should only be
available in case of conflict.
Regards,
--
Patrick Allaert
http://code.google.com/p/peclapm/ - Alternative PHP Monitor
Hi Patrick:
Hi,
Is this intended not being able to give a new name to a method even in
case of no conflict?
In the following example, I try to provide the name "sayIt"
additionally to "saySomething" from trait "Hello":<?php
trait Hello {
public function saySomething() {
echo 'Hello';
}
}class MyHello{
use Hello {
Hello::saySomething as sayIt;
}
}
?>
Thanks for catching this, it is a bug.
It works without the Hello:: part and it should also work with the Hello::.
Fixed with the following commit: http://svn.php.net/viewvc?view=revision&revision=305512
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525