Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CS: Apply ternary_to_null_coalescing fixer #39632

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

Merged
merged 1 commit into from
Dec 27, 2020

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Dec 26, 2020

Q A
Branch? 4.4
Bug fix? no
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

Since we don't need to support PHP 5 anymore, we can upgrade our older code to use the null coalescing operator and enforce its usage through our PHP CS Fixer configuration. I think, the usage of that operator improves the readability of our codebase at lot.

Note that the changes in this PR are (with the exception of .php_cs.dist) completely automated. You should get the same results by running the following command (and reverting the changes to PhpUnitBridge afterwards).

php-cs-fixer fix --rules='{"ternary_to_null_coalescing":true}' src

@@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
'combine_nested_dirname' => true,
'list_syntax' => ['syntax' => 'short'],
'visibility_required' => ['property', 'method', 'const'],
'ternary_to_null_coalescing' => true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should then be added to the @symfony ruleset of pho-cs-fixer, too

Copy link
Member

Choose a reason for hiding this comment

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

folks, do not hesitate to raise PR for Fixer repo ;)

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

I'll let you merge up to 5.x right after you merge the PR :)

@derrabus
Copy link
Member Author

The branches are in sync at the moment. Looks like a good moment to merge.

@derrabus derrabus merged commit fc794e5 into symfony:4.4 Dec 27, 2020
@derrabus derrabus deleted the improvement/null-coalescing branch January 10, 2021 14:45
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.