Edit report at https://bugs.php.net/bug.php?id=69262&edit=1
ID: 69262
Updated by: [email protected]
Reported by: andreas dot prucha at gmail dot com
Summary: Native property-support
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: PHP Language Specification
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This is a duplicate of bug #49526.
Previous Comments:
------------------------------------------------------------------------
[2015-03-19 19:43:56] [email protected]
Note that a similar RFC[1] has been declined.
[1] <https://wiki.php.net/rfc/propertygetsetsyntax-v1.2>
------------------------------------------------------------------------
[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.