On Sun Feb 13 05:15 AM, André Rømcke wrote: > > > > I have now made an RFC based on the most recent discussions: > > > > http://wiki.php.net/rfc/traitsmodifications > > > > I think it would sometimes be desirable to allow this, for instance > when a trait has been updated in a framework to adapt to what has > become common practice in classes that uses it in the wild. > ( I assume you already get error if function signature is different > like in inheritance? ) > > So to allow both cases, what about letting people use the final > keyword on functions to signal functions that cannot be re declared > without alias. Or better, add a new keyword since final should mean > final. >
I find the implementation in trunk convenient, traits aren't meant to replace inheritance & ~polymorphism. The 'final' keyword currently means nothing to the class: trait Foo { final static function test() { return 'Test'; } } class A { use Foo; static function test() { return 'Test2'; } } echo A::test(); // returns 'Test2' in trunk That might seem odd but it's not inheritance. There is no error if the class method signature is different from a trait. I'm comfortable with 'the class always wins', not really sure if should I be thinking differently... It makes a trait somewhat fragile but that's part of the design vs. grafts. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php