Re: Traits and Properties
| From: | Ben Schmidt | Date: | Mon, 03 Jan 2011 09:35:34 +0000 |
| Subject: | Re: Traits and Properties | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51208@lists.php.net to get a copy of this message | ||
Hi, Stefan,
On 3/01/11 8:16 PM, Stefan Marr wrote:
On 03 Jan 2011, at 10:04, Ben Schmidt wrote:OK. So this comment from your email is outdated?:In this email thread you seemed to be saying that properties defined in traits are completely ignored, but in the RFC and svn it seems to be saying that properties in traits are not ignored, but are merged into the class and/or trigger errors/warnings. So, which is it? Ignored or not? Or is some aspect of them ignored and some aspect not?The RFC was discussed on this list, and the RFC should explain what the current state of the implementation is. So, the RFC and the implementation are the specifications. In case they differ it has to be fixed.
However, at the moment it is possible to define properties in a trait: trait Foo { private $a; public $foo; } For the moment, that information is completely ignored, thus: class Bar { use Foo; } property_exists('Bar', 'a') === falsein light of this test: http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/property002.phpt?view=markup&pathrev=306476 Maybe the only thing that was confusing is that somebody replied to an old email? Ben.