-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Mirror switch comment to match to ChangeSwitchToMatchRector (#…
…5072) * [Php80] Mirror switch comment to match to ChangeSwitchToMatchRector * [Php80] Mirror switch comment to match to ChangeSwitchToMatchRector
- Loading branch information
1 parent
defd57b
commit 8bfaf45
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...-tests/Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/copy_switch_comment.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,40 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
class CopySwitchComment | ||
{ | ||
public function run() | ||
{ | ||
// some comment here | ||
switch ($this->lexer->lookahead['type']) { | ||
case Lexer::T_DELETE: | ||
$statement = $this->DeleteStatement(); | ||
break; | ||
|
||
default: | ||
$statement = $this->syntaxError('SELECT, UPDATE or DELETE'); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
class CopySwitchComment | ||
{ | ||
public function run() | ||
{ | ||
// some comment here | ||
$statement = match ($this->lexer->lookahead['type']) { | ||
Lexer::T_DELETE => $this->DeleteStatement(), | ||
default => $this->syntaxError('SELECT, UPDATE or DELETE'), | ||
}; | ||
} | ||
} | ||
|
||
?> |
40 changes: 40 additions & 0 deletions
40
.../Rector/Switch_/ChangeSwitchToMatchRector/Fixture/copy_switch_comment_with_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,40 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
class CopySwitchCommentWithReturn | ||
{ | ||
public function run($value) | ||
{ | ||
// some comment here | ||
switch ($value) { | ||
case 1: | ||
return 1000; | ||
break; | ||
|
||
default: | ||
return 2000; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
class CopySwitchCommentWithReturn | ||
{ | ||
public function run($value) | ||
{ | ||
// some comment here | ||
return match ($value) { | ||
1 => 1000, | ||
default => 2000, | ||
}; | ||
} | ||
} | ||
|
||
?> |
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