In relation to "Some people have asked why we don't reuse the syntax of the
switch statement". I do not think that it could cause a conflict with an
array. The same is valid for anonymous functions or classes: you need use
terminator (";"). I still prefer it than create another format to switch.
And maybe you should just use "return" here to specify the return value.
$x = switch ($y) {
case 1: return $y + 1;
case 2: return $y - 1;
// default: return null;
};
Atenciosamente,
David Rodrigues
Em ter., 31 de mar. de 2020 às 15:51, Ilija Tovilo <[email protected]>
escreveu:
> Hi internals
>
> A few days ago I opened the discussion on the switch expression RFC:
> https://wiki.php.net/rfc/switch_expression
>
> There's been a fundamental disagreement on what the switch expression
> should actually be. Due to the conflicting feedback I no longer know
> how to proceed. This is why I've created a poll to get a general
> feeling of what approach is preferred. If you can vote, **please**,
> vote.
>
> https://wiki.php.net/rfc/poll_switch_expression
>
> Ilija
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>