-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Allow indirect duplicated grouping on RemoveDuplicatedCase…
…InSwitchRector (#5234) * [DeadCode] Allow indirect duplicated grouping on RemoveDuplicatedCaseInSwitchRector * implemented 🎉 * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
437f96a
commit 3f2fb29
Showing
4 changed files
with
168 additions
and
12 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...ode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector/Fixture/indirect_duplicated.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class IndirectDuplicated | ||
{ | ||
public function run() | ||
{ | ||
switch ($name) { | ||
case 'clearAllHeaders': | ||
return $this->modifyHeader($node, 'replace'); | ||
case 'clearHeader': | ||
return $this->modifyHeader($node, 'remove'); | ||
case 'clearRawHeaders': | ||
return $this->modifyHeader($node, 'replace'); | ||
case '...': | ||
return 5; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class IndirectDuplicated | ||
{ | ||
public function run() | ||
{ | ||
switch ($name) { | ||
case 'clearAllHeaders': | ||
case 'clearRawHeaders': | ||
return $this->modifyHeader($node, 'replace'); | ||
case 'clearHeader': | ||
return $this->modifyHeader($node, 'remove'); | ||
case '...': | ||
return 5; | ||
} | ||
} | ||
} | ||
|
||
?> |
47 changes: 47 additions & 0 deletions
47
...ctor/Switch_/RemoveDuplicatedCaseInSwitchRector/Fixture/multi_indirect_duplicated.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class MultiIndirectDuplicated | ||
{ | ||
public function run() | ||
{ | ||
switch ($name) { | ||
case 'clearAllHeaders': | ||
return $this->modifyHeader($node, 'replace'); | ||
case 'clearHeader': | ||
return $this->modifyHeader($node, 'remove'); | ||
case 'clearRawHeaders': | ||
return $this->modifyHeader($node, 'replace'); | ||
case 'clearRawHeaders2': | ||
return $this->modifyHeader($node, 'replace'); | ||
case '...': | ||
return 5; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class MultiIndirectDuplicated | ||
{ | ||
public function run() | ||
{ | ||
switch ($name) { | ||
case 'clearAllHeaders': | ||
case 'clearRawHeaders': | ||
case 'clearRawHeaders2': | ||
return $this->modifyHeader($node, 'replace'); | ||
case 'clearHeader': | ||
return $this->modifyHeader($node, 'remove'); | ||
case '...': | ||
return 5; | ||
} | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters