Req #69262 [Com]: Native property-support

From: Date: Thu, 19 Mar 2015 19:43:56 +0000
Subject: Req #69262 [Com]: Native property-support
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-740@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69262&edit=1 ID: 69262 Comment by: cmb@php.net Reported by: andreas dot prucha at gmail dot com Summary: Native property-support Status: Open Type: Feature/Change Request Package: PHP Language Specification PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Note that a similar RFC[1] has been declined. [1] <https://wiki.php.net/rfc/propertygetsetsyntax-v1.2> Previous Comments: ------------------------------------------------------------------------ [2015-03-19 11:13:17] andreas dot prucha at gmail dot com Description: ------------ I think native support for properties like in Delphi would be nice. For example: { protected $myPropertyField; public proprety $myProperty get $myPropertyField set setMyProperty; public function setMyProperty($aValue) { $this->myPropertyField = $aValue; } } In the declaration a getter and setter could be defined, which could be either direct reference to a variable or a setter/getter function. I know it's syntatctic sugar, but it may make property declarations more obvious, easier to document (once phpdocumentor supports it) and it might even bring slight performance gains as we do not go through __get and __set to determine the getter/setter function. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69262&edit=1

« previous php.standards (#740) next »