|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
17 + 34 = ?
Subscribe to this entry?

 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 11:01:25 2021 UTC