Repository navigation
Conversation
iluuu1994
force-pushed
the
match-blocks
branch
from
August 23, 2023 21:28
b45c117 to
5cbea46
Compare
iluuu1994
force-pushed
the
match-blocks
branch
from
August 24, 2023 17:07
02e1448 to
3ccbc43
Compare
TimWolla
reviewed
Aug 25, 2023
| }); | ||
| ?> | ||
| --EXPECTF-- | ||
| Fatal error: 'goto' into loop or switch statement is disallowed in %s on line %d |
Member
There was a problem hiding this comment.
The error message should mention “match”.
iluuu1994
force-pushed
the
match-blocks
branch
3 times, most recently
from
August 25, 2023 16:56
5444ac5 to
04a31ab
Compare
iluuu1994
force-pushed
the
match-blocks
branch
from
December 8, 2023 17:08
04a31ab to
24218f8
Compare
xepozz
reviewed
Feb 2, 2025
| --FILE-- | ||
| <?php | ||
| $x = null; | ||
| $y = $x ?? { |
Contributor
There was a problem hiding this comment.
Is
$x = {
echo "test\n";
null
};also possible?
Member
Author
There was a problem hiding this comment.
No, not in this PR. Please read the RFC, the rationale is explained there. https://wiki.php.net/rfc/match_blocks#why_not_language-level_blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wiki.php.net/rfc/match_blocks
throwstatements non-terminators in match blocks. Alternatively, [WIP] Auto-extend live-ranges #11880.;is subtle. We could do<= $valueor some other symbol. The downside is that people may expect this to work anywhere in the block, which is currently not the case. The result must appear at the end of the block. Edit: I've settled on<-and=>for now. I picked<-over<=because ligatures often render<=as ≤.This is a much simpler alternative to master...iluuu1994:php-src:match-blocks-var-tracking, which allowed
return,break,continue, andgotoout of match expression blocks. This PR disallows escaping match blocks whose result value is used. This avoids tracking VARs that may have to be freed if an expression is escaped midway.