com php-langspec: Add the `iterable` pseudo-type.: spec/09-lexical-structure.md spec/13-functions.md spec/19-grammar.md
[email protected] (Nikita Popov) Fri, 02 Dec 2016 16:23:54 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 248ec2865a64827570a6894c732f5e6b481e0d95=0AAuthor: Ivan Ender= lin <[email protected]> Fri, 2 Dec 2016 09:13:57 +0100= =0ACommitter: Nikita Popov <[email protected]> Fri, 2 Dec 2016 17:23:54 +0= 100=0AParents: ae3a7639a05fae1cd1690ef28213bfebcb7d3af0=0ABranches: mast= er=0A=0ALink: http://git.php.net/?p=3Dphp-langspec.git;a=3Dcommitdiff= ;h=3D248ec2865a64827570a6894c732f5e6b481e0d95=0A=0ALog:=0AAdd the `iterable= ` pseudo-type.=0A=0ASee https://wiki.php.net/rfc/iterable.=0A=0AChanged pat= hs:=0A M spec/09-lexical-structure.md=0A M spec/13-functions.md=0A M = spec/19-grammar.md=0A=0A=0ADiff:=0Adiff --git a/spec/09-lexical-structure.m= d b/spec/09-lexical-structure.md=0Aindex ae8d4a2..7d11b77 100644=0A--- a/sp= ec/09-lexical-structure.md=0A+++ b/spec/09-lexical-structure.md=0A@@ -355,7= +355,7 @@ Unless stated otherwise ([functions](13-functions.md#function-de= finitions),=0A =0A Names beginning with two underscores (__) are reserved b= y the PHP language and should not be defined by the user code.=0A =0A-The f= ollowing names cannot be used as the names of classes, interfaces, or trait= s: `bool`, `FALSE`, `float`, `int`, `NULL`, `string`, `TRUE`, and `void`.= =0A+The following names cannot be used as the names of classes, interfaces,= or traits: `bool`, `FALSE`, `float`, `int`, `NULL`, `string`, `TRUE`, `ite= rable`, and `void`.=0A =0A The following names are reserved for future use = and should not be used as the names of classes, interfaces, or traits: `mix= ed`, `numeric`, `object`, and `resource`.=0A =0Adiff --git a/spec/13-functi= ons.md b/spec/13-functions.md=0Aindex 4311b04..1d3ff81 100644=0A--- a/spec/= 13-functions.md=0A+++ b/spec/13-functions.md=0A@@ -79,6 +79,7 @@ return-typ= e:=0A type-declaration:=0A 'array'=0A 'callable'=0A+ 'iterable'=0A s= calar-type=0A qualified-name=0A =0A@@ -124,6 +125,7 @@ default-argument-s= pecifier:=0A <i id=3D"grammar-type-declaration">type-declaration:</i>=0A = array=0A callable=0A+ iterable=0A <i><a href=3D"#grammar-scalar-ty= pe">scalar-type</a></i>=0A <i><a href=3D"09-lexical-structure.md#grammar= -qualified-name">qualified-name</a></i>=0A =0A@@ -193,10 +195,12 @@ By defa= ult, a parameter will accept an argument of any type. However, by=0A specif= ying a *type-declaration*, the types of argument accepted can be=0A restric= ted. By specifying `array`, only an argument of the `array`=0A type is acce= pted. By specifying `callable`, only an argument designating a=0A-function = (see below) is accepted. By specifying *qualified-name*, only an instance= =0A-of a class having that type, or being derived from that type, are=0A-ac= cepted, or only an instance of a class that implements that interface=0A-ty= pe directly or indirectly is accepted. The check is the same as for [`insta= nceof` operator](10-expressions.md#instanceof-operator).=0A+function (see b= elow) is accepted. By specifying `iterable`, only an argument that=0A+is of= type `array` or an object implementing the `Traversable` interface is acce= pted.=0A+By specifying *qualified-name*, only an instance of a class having= that type,=0A+or being derived from that type, are accepted, or only an in= stance of a class that=0A+implements that interface type directly or indire= ctly is accepted. The check is the=0A+same as for [`instanceof` operator](1= 0-expressions.md#instanceof-operator).=0A =0A `callable` pseudo-type accept= s the following:=0A * A string value containing the name of a function defi= ned at the moment of the call.=0Adiff --git a/spec/19-grammar.md b/spec/19-= grammar.md=0Aindex 53ec956..1975070 100644=0A--- a/spec/19-grammar.md=0A+++= b/spec/19-grammar.md=0A@@ -931,6 +931,7 @@ The grammar notation is describ= ed in [Grammars section](09-lexical-structure.md#=0A <i id=3D"grammar-type-= declaration">type-declaration:</i>=0A array=0A callable=0A+ iterabl= e=0A <i><a href=3D"#grammar-scalar-type">scalar-type</a></i>=0A <i><a= href=3D"#grammar-qualified-name">qualified-name</a></i>=0A