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

MultilineCommentOpeningClosingFixer - fix handling empty comment #4181

Merged
merged 1 commit into from
Jan 1, 2019
Merged

MultilineCommentOpeningClosingFixer - fix handling empty comment #4181

merged 1 commit into from
Jan 1, 2019

Conversation

kubawerlos
Copy link
Contributor

Fixes #4179

@kubawerlos
Copy link
Contributor Author

Ping @Slamdunk as the author of fixer.

@@ -37,7 +37,9 @@ public function testFix($expected, $input = null)
public function provideDocblocksCases()
{
return [
['<?php /* Opening comment */'],
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already tested below with '<?php /*** Opening Multiline comment */'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted implicit test as we change the comment with RegExes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry I don't get your comment 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I started checking tests I wondered why the first one is for doc comment and there is none for comment - I (hopefully I'm not the only one) read tests from top to the bottom to understand what is going and and I prefer to have the simplest - happy paths - at the begging - that's why I've added this one and /**/.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok. In this case it should be better to rearrange and rename the current test cases instead of repeating an existing one, IMHO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Slamdunk rearranged

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

['<?php /** Opening DocBlock */'],
['<?php /**/'],
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already tested below in '<?php /***/'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the expected value is checked to not being changes again, right? Wouldn't this test case make it more explicit?

Copy link
Contributor

Choose a reason for hiding this comment

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

@keradus set up that all the expected values are also tested against themselves, this is done for every test-case in this library, so we can skip a lot of duplicated code in the tests

Copy link
Member

Choose a reason for hiding this comment

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

That's how tricky I am, ain't I?

@Slamdunk
Copy link
Contributor

👍 https://3v4l.org/IZlsP

@keradus
Copy link
Member

keradus commented Jan 1, 2019

Thank you @kubawerlos.

@keradus keradus merged commit 424e278 into PHP-CS-Fixer:2.12 Jan 1, 2019
keradus added a commit that referenced this pull request Jan 1, 2019
…mment (kubawerlos)

This PR was merged into the 2.12 branch.

Discussion
----------

MultilineCommentOpeningClosingFixer - fix handling empty comment

Fixes #4179

Commits
-------

424e278 MultilineCommentOpeningClosingFixer - fix handling empty comment
@kubawerlos kubawerlos deleted the fix-multiline-comment-opening-closing-empty-comment branch January 1, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants