Skip to content

Short match #6511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

Short match #6511

wants to merge 6 commits into from

Conversation

Crell
Copy link
Contributor

@Crell Crell commented Dec 13, 2020

Adds support for short-circuiting a match() expression to match against boolean true. This is a convenience feature left out of the original match() RFC for simplicity but widely supported, so let's bring it back.

https://wiki.php.net/rfc/short-match

@iluuu1994
Copy link
Member

You'll need to handle the AST printer (look at test 009.phpt).

$a = 3;
assert(match {
    $a < 2 => 'small',
    $a == 3 => false,
    default => 'large',
});

@cmb69
Copy link
Member

cmb69 commented Dec 2, 2021

What's the status here? This PR has an RFC label; if it needs an RFC, there should be one, but I'm not sure about that.

@iluuu1994
Copy link
Member

@cmb69 There's one in draft. I linked it above.

@iluuu1994
Copy link
Member

Nothing has happened here for a while so I'm closing this PR and the corresponding RFC. Feel free to reopen whenever you're ready to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants