RE: [PHP-DEV] RFC: Property get/set syntax
| From: | Clint M Priest | Date: | Sun, 22 Apr 2012 02:36:05 +0000 |
| Subject: | RE: [PHP-DEV] RFC: Property get/set syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60254@lists.php.net to get a copy of this message | ||
> How these would work with isset - what !empty($this->Hours) return? What would happen if you
> do unset($this->Hours)? What happens if you do $this->Hours++ or sort($this->Hours)
> (assuming $Hours is an array)?
> These things need to be defined in the RFC too.
So I've just tested these things and the accessors perform the same way as with
__get()/__set().
empty() - Returns true for a property retrieved via __get() or via a getter -- Any idea why this
would be the case for __get()? Is this a bug?
unset() - Would unset a temporary variable (the one returned by the getter) -- see previous email
re: adding unset/isset property functions.
sort() - Does the same thing as with __get()/__set() which is to say, the array is sorted but the
property is not updated with the value. Should accessor behave differently than the magic methods?
Should this just be documents or should this be fixed?
-Clint