com php-langspec: Merge branch 'PHP-7.0': spec/09-lexical-structure.md spec/10-expressions.md spec/11-statements.md spec/13-functions.md
[email protected] (Nikita Popov) Sun, 24 Apr 2016 13:16:26 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: afa1383dc9e148b21f14f05c055053b6b1230528 Author: Nikita Popov <[email protected]> Sun, 24 Apr 2016 15:16:26 +0200 Parents: 04a04985dfcca2a1901144e1927c1f148e428d96 875d1be2800b81c53aa411cc7770e8b7a80dd1e2 Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=afa1383dc9e148b21f14f05c055053b6b1230528 Log: Merge branch 'PHP-7.0' Conflicts: spec/10-expressions.md Changed paths: MM spec/09-lexical-structure.md MM spec/10-expressions.md MM spec/11-statements.md MM spec/13-functions.md Diff: diff --cc spec/10-expressions.md index ba628bb,a68c3ae..cc145b6 --- a/spec/10-expressions.md +++ b/spec/10-expressions.md @@@ -454,8 -446,7 +454,8 @@@ target variables. On success, it return source array is not an array or object implementing `ArrayAccess` no assignments are performed and the return value is `NULL`. - For *unkeyed-list-expression-list*, all elements in the source array having -All elements in the source array having keys of type `string` are ignored. ++For *unkeyed-list-expression-list*, all elements in the source array having +keys of type `string` are ignored. The element having an `int` key of 0 is assigned to the first target variable, the element having an `int` key of 1 is assigned to the second target variable, and so on, until all target variables have been @@@ -464,16 -455,7 +464,16 @@@ fewer source array elements having int variables, the unassigned target variables are set to `NULL` and a non-fatal error is produced. +For *keyed-list-expression-list*, each key-variable pair is handled in turn, +with the key and variable being separated by the `=>` symbol. +The element having the first key, with the key having been converted using the +same rules as the [subscript operator](10-expressions.md#subscript-operator), +is assigned to the frst target variable. This process is repeated for the +second `=>` pair, if any, and so on. Any other array elements are ignored. +If there is no array element with a given key, the unassigned target variable +is set to `NULL` and a non-fatal error is produced. + - The assignments must occur in this order. + The assignments must occur in this order. Any target variable may be a list, in which case, the corresponding element is expected to be an array. diff --cc spec/13-functions.md index 247c344,d59446d..fbbfb61 --- a/spec/13-functions.md +++ b/spec/13-functions.md @@@ -186,16 -185,13 +186,16 @@@ be compatible with the defined type, us are not allowed for typed returns. If the value of the [`return` statement](11-statements.md#the-return-statement) does not pass the type check, a fatal error is produced. +The `void` type is a special type that can only be used as a return type, and +not in other contexts. It has no effect at runtime, see the [`return` statement](11-statements.md#the-return-statement). + ## Type check modes - The type checking can be performed in two modes, strict and coercive (default). - The difference between modes exists only for scalar typed parameters (`int`, `float`, `string` and `bool`). + The type checking can be performed in two modes, strict and coercive (default). + The difference between modes exists only for scalar typed parameters (`int`, `float`, `string` and `bool`). For coercive mode, if the value passed is of the same type as the parameter, it is accepted. - If not, the [conversion](08-conversions.md#general) is attempted. If the conversion succeeds, + If not, the [conversion](08-conversions.md#general) is attempted. If the conversion succeeds, the converted value is the value assigned to the parameter. If the conversion fails, a fatal error is produced.