rfc:automatic_property_initialization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:automatic_property_initialization [2013/09/27 06:17] – created goohrfc:automatic_property_initialization [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== PHP RFC: Automatic Property Initialization ====== ====== PHP RFC: Automatic Property Initialization ======
  
-  * Version: 0.1+  * Version: 0.2
   * Date: 2013-09-27   * Date: 2013-09-27
   * Author: Gordon Oheim, gooh@php.net (patch provided by NikiC, nikic@php.net)   * Author: Gordon Oheim, gooh@php.net (patch provided by NikiC, nikic@php.net)
-  * Status: Under Discussion+  * Status: Declined
   * First Published at: https://wiki.php.net/rfc/automatic_property_initialization   * First Published at: https://wiki.php.net/rfc/automatic_property_initialization
  
Line 102: Line 102:
     abstract public function __construct($this->foo);     abstract public function __construct($this->foo);
  
 +Writing this is equivalent to having an abstract method with a body, which makes no sense.
 ===== Inheritance ===== ===== Inheritance =====
  
Line 126: Line 127:
  
 will '''not''' automatically assign $x and $y to the corresponding properties. This also means that if you have to do additional work in the constructor, you will have to assign arguments just like you always did. Likewise, this variant does not allow mixing of property arguments and regular arguments. Whether such a methodless constructor should then create public properties for non-existing properties would be subject to debate. will '''not''' automatically assign $x and $y to the corresponding properties. This also means that if you have to do additional work in the constructor, you will have to assign arguments just like you always did. Likewise, this variant does not allow mixing of property arguments and regular arguments. Whether such a methodless constructor should then create public properties for non-existing properties would be subject to debate.
- 
-Personally, I'd prefer this one. I'll flesh it out if the general consensus is that this more desired. 
  
 ===== Methodless Constructors ===== ===== Methodless Constructors =====
Line 182: Line 181:
   * https://wiki.php.net/rfc/constructor-promotion   * https://wiki.php.net/rfc/constructor-promotion
  
-===== Rejected Features =====+===== Reception ===== 
 + 
 +There was little feedback on internals regarding this RFC but the few responses that have been made were generally in favor of this feature. The notable exception being the HHVM team that would prefer their own implementation of constructor promotion. No particular extra features have been rejected or strongly favored. 
 + 
 +===== Vote ===== 
 + 
 +The vote is for the current patch. You are solely voting on allowing $this->foo as constructor arguments. None of the other suggested features in this document are subject to vote. 
 + 
 +The vote is to allow the following syntax, nothing more: 
 + 
 +    public function __construct($this->foo) 
 +    { 
 +    } 
 + 
 +**Notes**: The curly braces //must// be present. This syntax is //only// available for constructors. Only ''$this->'' is allowed, not ''$blah->''
 + 
 +Vote start: 2013/01/31 01:00 UTC 
 +Vote end: 2014/02/10 01:00 UTC
  
-none so far+<doodle title="Automatic Property Initialization" auth="gooh" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
rfc/automatic_property_initialization.1380262678.txt.gz · Last modified: 2017/09/22 13:28 (external edit)