Skip to content
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

Formatting for the group multiline alignment for match arm arrows #6074 #6884

Merged

Conversation

junichi11
Copy link
Member

Example:

match ($type1) {
    'integer', 'test' => 'test',
    'string' => match ($type2) {
        1, 2 => "test",
        3 => "test",
        4 => "test",
    },
    default => null,
};

Result:

match ($type1) {
    'integer', 'test' => 'test',
    'string'          => match ($type2) {
        1, 2 => "test",
        3    => "test",
        4    => "test",
    },
    default           => null,
};

nb-php-gh-6074-match-arm-arrow-alignment-option

@junichi11 junichi11 added the PHP [ci] enable extra PHP tests (php/php.editor) label Dec 27, 2023
@junichi11 junichi11 added this to the NB21 milestone Dec 27, 2023
@junichi11 junichi11 linked an issue Dec 27, 2023 that may be closed by this pull request
Copy link
Member

@tmysik tmysik left a comment

Choose a reason for hiding this comment

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

Great to have all the tests, thanks!

@junichi11
Copy link
Member Author

@tmysik Thank you for your quick review! I'll merge it after I fix the typos :)

@junichi11 junichi11 force-pushed the php-gh-6074-match-arm-w-arrow-alignment branch from 5271e29 to 53dd6d3 Compare December 27, 2023 12:10
…che#6074

- apache#6074
- Add "Match Arm Arrow" as an alignment option
- Add/Fix unit tests

Example:
```php
match ($type1) {
    'integer', 'test' => 'test',
    'string' => match ($type2) {
        1, 2 => "test",
        3 => "test",
        4 => "test",
    },
    default => null,
};
```

Result:

```php
match ($type1) {
    'integer', 'test' => 'test',
    'string'          => match ($type2) {
        1, 2 => "test",
        3    => "test",
        4    => "test",
    },
    default           => null,
};
```
@junichi11 junichi11 force-pushed the php-gh-6074-match-arm-w-arrow-alignment branch from 53dd6d3 to 0737cce Compare December 27, 2023 16:27
@junichi11 junichi11 merged commit f8055bb into apache:master Dec 27, 2023
34 checks passed
@junichi11 junichi11 deleted the php-gh-6074-match-arm-w-arrow-alignment branch December 27, 2023 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formating of "match" expression same as arrays in PHP
2 participants