|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69262 Native property-support
Submitted: 2015-03-19 11:13 UTC Modified: 2015-03-20 14:49 UTC
From: andreas dot prucha at gmail dot com Assigned:
Status: Duplicate Package: PHP Language Specification
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-03-19 11:13 UTC] andreas dot prucha at gmail dot com
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-19 19:43 UTC]
Note that a similar RFC[1] has been declined.

[1] <>
 [2015-03-20 14:49 UTC]
-Status: Open +Status: Duplicate
 [2015-03-20 14:49 UTC]
This is a duplicate of bug #49526.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Apr 02 06:03:36 2023 UTC