Re: 5.4a2 trait attribute name conflict resolution

From: Date: Fri, 22 Jul 2011 16:18:27 +0000
Subject: Re: 5.4a2 trait attribute name conflict resolution
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-54136@lists.php.net to get a copy of this message
On 22 July 2011 09:12, Alex Howansky <alex.howansky@gmail.com> wrote: > >> That makes sense if it would overwrite the methods as well, but >> otherwise it seems like it provides inconsistent functionality. > > Exactly. At the least, it's inconsistent. If it's a bug, then it seems the > question becomes: > > Is the bug this: > > "Properties defined in a trait should be overridden by same-named properties > defined in a class that use the trait." > > Or (as pointed out by Anthony) this: > > "You shouldn't be able to define properties in a trait." Traits definitely need to be able to support properties, IMO, so I'd say that the first behaviour just needs to be documented (and potentially a notice added). Either the trait or the class is going to have its property overwritten, so we should pick which definition wins and go from there. Adam

« previous php.internals (#54136) next »