Skip to content

Commit

Permalink
bug PHP-CS-Fixer#4996 NoEmptyCommentFixer - handle multiline comments…
Browse files Browse the repository at this point in the history
… (kubawerlos)

This PR was squashed before being merged into the 2.15 branch (closes PHP-CS-Fixer#4996).

Discussion
----------

NoEmptyCommentFixer - handle multiline comments

Commits
-------

f83dc08 NoEmptyCommentFixer - handle multiline comments
  • Loading branch information
SpacePossum committed Jun 14, 2020
2 parents 83a4ac3 + f83dc08 commit 520e931
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Fixer/Comment/NoEmptyCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function isEmptyComment($content)
{
static $mapper = [
self::TYPE_HASH => '|^#\s*$|', // single line comment starting with '#'
self::TYPE_SLASH_ASTERISK => '|^/\*\s*\*/$|', // comment starting with '/*' and ending with '*/' (but not a PHPDoc)
self::TYPE_SLASH_ASTERISK => '|^/\*[\s\*]*\*+/$|', // comment starting with '/*' and ending with '*/' (but not a PHPDoc)
self::TYPE_DOUBLE_SLASH => '|^//\s*$|', // single line comment starting with '//'
];

Expand Down
20 changes: 20 additions & 0 deletions tests/Fixer/Comment/NoEmptyCommentFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@ public function provideFixCases()
$bar = 2;
',
],
[
'<?php
'.'
',
'<?php
/*
*
*/
',
],
[
'<?php
'.'
',
'<?php
/********
*
********/
',
],
];
}

Expand Down

0 comments on commit 520e931

Please sign in to comment.