rfc:propertygetsetsyntax-alternative-typehinting-syntax

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:propertygetsetsyntax-alternative-typehinting-syntax [2013/01/20 15:19] – Add patch nikicrfc:propertygetsetsyntax-alternative-typehinting-syntax [2013/01/20 15:21] – Add note on nullability of properties with accessors nikic
Line 102: Line 102:
  
 Note that properties are ''null'' initialized by default. The nullability semantics do not (and can not) affect this. They only specify whether it's possible to **assign** ''null'' to the property after initialization. Note that properties are ''null'' initialized by default. The nullability semantics do not (and can not) affect this. They only specify whether it's possible to **assign** ''null'' to the property after initialization.
 +
 +Default values can only be used on the shorthand notation. If accessor methods are specified a default value can not be used. The only exception is the ''= null'' default, which can still be used to specify nullability:
 +
 +<code php>
 +public DateTime $date = null {
 +    get { ... } set { ... }
 +}
 +</code>
  
 ===== Benefits of the proposed syntax ===== ===== Benefits of the proposed syntax =====
rfc/propertygetsetsyntax-alternative-typehinting-syntax.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1