-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EarlyReturn] Move comment in If_ stmt for ChangeAndIfToEarlyReturnRe…
…ctor (#648)
- Loading branch information
1 parent
90fd207
commit e35724e
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...yReturn/Rector/If_/ChangeAndIfToEarlyReturnRector/Fixture/move_comment_in_if_stmt.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,39 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector\Fixture; | ||
|
||
class MoveCommentInIfStmt | ||
{ | ||
public function canDrive(Car $car) | ||
{ | ||
if ($car->hasWheels && $car->hasFuel) { | ||
// a comment | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector\Fixture; | ||
|
||
class MoveCommentInIfStmt | ||
{ | ||
public function canDrive(Car $car) | ||
{ | ||
if (!$car->hasWheels) { | ||
return false; | ||
} | ||
if (!$car->hasFuel) { | ||
return false; | ||
} | ||
// a comment | ||
return true; | ||
} | ||
} | ||
|
||
?> |
42 changes: 42 additions & 0 deletions
42
...Return/Rector/If_/ChangeAndIfToEarlyReturnRector/Fixture/move_comment_in_if_stmt2.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,42 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector\Fixture; | ||
|
||
class MoveCommentInIfStmt2 | ||
{ | ||
public function canDrive(Car $car) | ||
{ | ||
if ($car->hasWheels && $car->hasFuel) { | ||
// a comment | ||
return true; | ||
} | ||
|
||
// another comment | ||
return false; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector\Fixture; | ||
|
||
class MoveCommentInIfStmt2 | ||
{ | ||
public function canDrive(Car $car) | ||
{ | ||
if (!$car->hasWheels) { | ||
// another comment | ||
return false; | ||
} | ||
if (!$car->hasFuel) { | ||
// another comment | ||
return false; | ||
} | ||
// a comment | ||
return true; | ||
} | ||
} | ||
|
||
?> |
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