Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Handle different indirect duplicated on RemoveDuplicatedCa…
…seInSwitchRector (#5236) * [DeadCode] Handle different indirect duplicated on RemoveDuplicatedCaseInSwitchRector * Fixed 🎉 * add more fixture * more fixture * phpstan * fixed
- Loading branch information
1 parent
c61d8ea
commit bee1dae
Showing
3 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.../Switch_/RemoveDuplicatedCaseInSwitchRector/Fixture/different_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 DiffrentIndirectDuplicated | ||
{ | ||
public function run($name) | ||
{ | ||
switch ($name) { | ||
case 'a': | ||
return 'A'; | ||
case 'b': | ||
return 'B'; | ||
case 'c'; | ||
return 'C'; | ||
case 'd': | ||
return 'A'; | ||
case 'e': | ||
return 'B'; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class DiffrentIndirectDuplicated | ||
{ | ||
public function run($name) | ||
{ | ||
switch ($name) { | ||
case 'a': | ||
case 'd': | ||
return 'A'; | ||
case 'b': | ||
case 'e': | ||
return 'B'; | ||
case 'c'; | ||
return 'C'; | ||
} | ||
} | ||
} | ||
|
||
?> |
50 changes: 50 additions & 0 deletions
50
...Switch_/RemoveDuplicatedCaseInSwitchRector/Fixture/different_indirect_duplicated2.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,50 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class DiffrentIndirectDuplicated2 | ||
{ | ||
public function run($name) | ||
{ | ||
switch ($name) { | ||
case 'a': | ||
return 'A'; | ||
case 'b': | ||
return 'B'; | ||
case 'c'; | ||
return 'C'; | ||
case 'f': | ||
return 'C'; | ||
case 'd': | ||
return 'A'; | ||
case 'e': | ||
return 'B'; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector\Fixture; | ||
|
||
class DiffrentIndirectDuplicated2 | ||
{ | ||
public function run($name) | ||
{ | ||
switch ($name) { | ||
case 'a': | ||
case 'd': | ||
return 'A'; | ||
case 'b': | ||
case 'e': | ||
return 'B'; | ||
case 'c': | ||
case 'f': | ||
return 'C'; | ||
} | ||
} | ||
} | ||
|
||
?> |
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