Re: Property Accessors v1.2
| From: | Stas Malyshev | Date: | Tue, 16 Oct 2012 10:59:01 +0000 |
| Subject: | Re: Property Accessors v1.2 | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63455@lists.php.net to get a copy of this message | ||
Hi!
> I apologize for my confusing terminology - let me elaborate. There are
> no special syntaxes. The below code should help clear things up a bit:
>
> class MyClass {
> private $otherProperty;
> public $property {
> get() {}; // Does not "have a body", as there is no code between
> the curly braces.
It does have a body. This body is just default empty method body
returning null - which does not throw any exceptions and is completely
indistinguishable from the outside from property being equal to null.
I'm not sure it's what the intent of *-only variable is, though I guess
it is a way to hack around it. I wonder however if it can be done better.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227