com php-langspec: Add nullable types: spec/13-functions.md spec/19-grammar.md
[email protected] (Nikita Popov) Tue, 19 Sep 2017 06:34:50 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 287030c352f0019a2f9dee2077ad146d0d3e3e8c=0AAuthor: Nikita Pop= ov <[email protected]> Tue, 19 Sep 2017 08:34:50 +0200=0AParents: 9cf= 8b200e55968b9e542c6cb70563d35ec347bf8=0ABranches: master=0A=0ALink: = http://git.php.net/?p=3Dphp-langspec.git;a=3Dcommitdiff;h=3D287030c352f0019= a2f9dee2077ad146d0d3e3e8c=0A=0ALog:=0AAdd nullable types=0A=0AFixed #196.= =0A=0ABugs:=0Ahttps://bugs.php.net/196=0A=0AChanged paths:=0A M spec/13-f= unctions.md=0A M spec/19-grammar.md=0A=0A=0ADiff:=0Adiff --git a/spec/13-= functions.md b/spec/13-functions.md=0Aindex 3e253de..6d46b01 100644=0A--- a= /spec/13-functions.md=0A+++ b/spec/13-functions.md=0A@@ -77,6 +77,9 @@ retu= rn-type:=0A ':' 'void'=0A =0A type-declaration:=0A+ '?'? base-type-decla= ration=0A+=0A+base-type-declaration:=0A 'array'=0A 'callable'=0A 'ite= rable'=0A@@ -123,6 +126,9 @@ default-argument-specifier:=0A : void=0A = =0A <i id=3D"grammar-type-declaration">type-declaration:</i>=0A+ ?<sub>op= t</sub> <i><a href=3D"#grammar-base-type-declaration">base-type-declarati= on</a></i>=0A+=0A+<i id=3D"grammar-base-type-declaration">base-type-declara= tion:</i>=0A array=0A callable=0A iterable=0A@@ -218,7 +224,9 @@ P= arameters typed with *scalar-type* are accepted if they pass the type check= for=0A as [described below](#type-check-modes). Once the checks have been = passed, the parameter types are always of the scalar type=0A specified (or = `NULL` if `NULL` is allowed).=0A =0A-If a parameter has a type declaration,= `NULL` is not accepted unless it has a default value that evaluates to `NU= LL`.=0A+If a parameter has a type declaration, `NULL` is not accepted unles= s the=0A+type is nullable. A type is nullable if it is prefixed with `?` or= if the=0A+parameter has a default value that evaluates to `NULL`.=0A =0A T= he default value for a typed parameter must be of the type specified, or `N= ULL`,=0A and conversion is not be performed for defaults, regardless of the= mode.=0Adiff --git a/spec/19-grammar.md b/spec/19-grammar.md=0Aindex 0cc0a= 9a..16c007e 100644=0A--- a/spec/19-grammar.md=0A+++ b/spec/19-grammar.md=0A= @@ -929,6 +929,9 @@ The grammar notation is described in [Grammars section]= (09-lexical-structure.md#=0A : void=0A =0A <i id=3D"grammar-type-decla= ration">type-declaration:</i>=0A+ ?<sub>opt</sub> <i><a href=3D"#gramma= r-base-type-declaration">base-type-declaration</a></i>=0A+=0A+<i id=3D"gram= mar-base-type-declaration">base-type-declaration:</i>=0A array=0A cal= lable=0A iterable=0A