Skip to content

Commit

Permalink
Merge branch '2.16' into 2.17
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Dec 7, 2020
2 parents f8243f0 + eae6b9b commit 4874565
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Changelog for v2.17.0
* bug #4794 TernaryToElvisOperatorFixer - fix open tag with echo (SpacePossum)
* bug #5084 Fix for variables within string interpolation in lambda_not_used_import (GrahamCampbell)
* bug #5094 SwitchContinueToBreakFixer - do not support alternative syntax (SpacePossum)
* bumped version
* feature #2619 PSR-5 @inheritDoc support (julienfalque)
* feature #3253 Add SimplifiedIfReturnFixer (Slamdunk, SpacePossum)
* feature #4005 GroupImportFixer - introduction (greeflas)
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ControlStructure/NoBreakCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function fixCase(Tokens $tokens, $casePosition)
if ($tokens[$i]->isGivenKind([T_THROW])) {
$previousIndex = $tokens->getPrevMeaningfulToken($i);

if ($previousIndex === $caseColonIndex || $tokens[$previousIndex]->equalsAny(['{', ';', [T_OPEN_TAG]])) {
if ($previousIndex === $caseColonIndex || $tokens[$previousIndex]->equalsAny(['{', ';', '}', [T_OPEN_TAG]])) {
$fallThrough = false;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Fixer/ControlStructure/NoBreakCommentFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testFixWithExplicitDefaultConfiguration($expected, $input = null
$this->fixer->configure([
'comment_text' => 'no break',
]);

$this->doTest($expected, $input);
}

Expand Down Expand Up @@ -876,6 +877,19 @@ public function provideTestFixCases()
}
',
],
[
'<?php
switch ($f) {
case 1:
if ($a) {
return "";
}
throw new $f();
case Z:
break;
}',
],
];
}

Expand Down

0 comments on commit 4874565

Please sign in to comment.