-
-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Skip Assign on its var not directly used in next return on Ch…
…angeSwitchToMatchRector (#2535) * [Php80] Skip Assign on ArrayDimFetch used next return on ChangeSwitchToMatchRector * Fixed 🎉 * final touch: compare next return expr * final touch: clean up * really final touch: rename fixture * really final touch: rename fixture * really final touch: rename method and vars
- Loading branch information
1 parent
4eeadae
commit f4a9b50
Showing
2 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...itchToMatchRector/Fixture/skip_assign_on_its_var_not_directly_used_in_next_return.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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class SkipAssignOnItsVarNotDirectlyUsedInNextReturn | ||
{ | ||
public const STATUS_A = 'a'; | ||
public const STATUS_B = 'b'; | ||
public const STATUS_C = 'c'; | ||
public const STATUS_D = 'd'; | ||
|
||
public function run(): \Closure | ||
{ | ||
return static function (self $item) { | ||
$class = []; | ||
switch ($item->status) { | ||
case self::STATUS_A: | ||
$class[] = 'green'; | ||
break; | ||
|
||
case self::STATUS_B: | ||
case self::STATUS_C: | ||
case self::STATUS_D: | ||
$class[] = 'red'; | ||
break; | ||
} | ||
|
||
return execute($class); | ||
}; | ||
} | ||
} |
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