Skip to content

Add tests for match expressions #12433

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

Conversation

juliend2
Copy link
Contributor

This is my first PR in this project.
I would like to add a few tests for the match expression syntax.

I based my branch off the PHP-8.1 branch. Is that okay?

Thanks!

@Girgias Girgias requested a review from iluuu1994 October 14, 2023 18:34
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful these are, as I don't think they tests something (technically, not lexically) that isn't tested yet. Since the tests are small and fast I won't object.

$d = 'd';
echo match($d) {
'foo' => 'bar',
match ($d) { default => 'd' }, match ($d) { default => 'e' } => 500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be on two lines

--FILE--
<?php

echo match ( match ('b') { default => 'b' } ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the spaces around the inner match.

@juliend2 juliend2 requested a review from iluuu1994 October 21, 2023 19:15
@iluuu1994 iluuu1994 closed this in 226b92b Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants