Re: Type hints in array destructuring expressions
| From: | Enno Woortmann | Date: | Thu, 16 Apr 2020 14:02:31 +0000 |
| Subject: | Re: Type hints in array destructuring expressions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109685@lists.php.net to get a copy of this message | ||
Hi,
- It has been requested several times on this list to stop using the wording "type hint" and instead write "type declaration" ;)I've updated the RFC to use the "type declaration" wording, thanks for the hint :)
- When I see this example in the RFC:As the RFC tackles array destructuring expressions and not foreach loops (which is just an option to use array destructuring there) I think this is out of scope for the RFC. I've added it to the future scope section though as I think it would align with the current proposal. Thanks for the input! Cheers, Enno$years = [["now", 2020], ["future", 2021]]; foreach ($years as [string $description, int $year]) {I immediately think of a similar:$years = ["now" => 2020, "future" => 2021]; foreach ($years as string $description => int $year) {or:$foos = [new Foo("one"), new Foo("two")]; foreach ($foos as Foo $foo) {