-
-
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.
[EarlyReturn] Skip left or right is BooleanAnd on ChangeOrIfReturnToE…
…arlyReturnRector (#799) * [EarlyReturn] Handle left or right is BooleanAnd on ChangeOrIfReturnToEarlyReturnRector * skip * remove tweak in DateTimeToDateTimeInterfaceRector * naming * remove tweak in RemoveAlwaysElseRector * rename fixture
- Loading branch information
1 parent
c42b196
commit 2e18cab
Showing
10 changed files
with
100 additions
and
138 deletions.
There are no files selected for viewing
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
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
41 changes: 0 additions & 41 deletions
41
tests/Issues/IssueEarlyReturnAndOr/Fixture/fixture.php.inc
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
tests/Issues/IssueEarlyReturnAndOr/Fixture/skip_next_or.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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\Tests\Issues\IssueEarlyReturnAndOr\Fixture; | ||
|
||
class SkipAndNextOr | ||
{ | ||
public function run($a, $b, $c, $d) | ||
{ | ||
if (($a && false === $b) || ! $c) { | ||
return ''; | ||
} | ||
|
||
return $d; | ||
} | ||
} | ||
|
||
?> |
59 changes: 0 additions & 59 deletions
59
tests/Issues/IssueEarlyReturnAndOrDatetime/Fixture/and_next_or.php.inc
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
tests/Issues/IssueEarlyReturnAndOrDatetime/Fixture/skip_and_next_or.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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\Tests\Issues\IssueEarlyReturnAndOrDatetime\Fixture; | ||
|
||
class SkipAndNextOr | ||
{ | ||
public function run($a, $b, $c, $d) | ||
{ | ||
if ($a && $b || $c) { | ||
return null; | ||
} | ||
|
||
$a = 1; | ||
$b = 2; | ||
|
||
if ($b > $a) { | ||
return null; | ||
} | ||
|
||
$d = 1; | ||
|
||
return; | ||
} | ||
} | ||
|
||
?> |
42 changes: 42 additions & 0 deletions
42
tests/Issues/IssueReturnBeforeElseIf/Fixture/complex_if_cond_or.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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\Tests\Issues\IssueReturnBeforeElseIf\Fixture; | ||
|
||
class ComplexIfCondOr | ||
{ | ||
public function run($a, $b, $c, $d, $e) | ||
{ | ||
if (($a && false === $b) || ! $c) { | ||
return ''; | ||
} elseif ($d) { | ||
return ''; | ||
} | ||
return $e; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Core\Tests\Issues\IssueReturnBeforeElseIf\Fixture; | ||
|
||
class ComplexIfCondOr | ||
{ | ||
public function run($a, $b, $c, $d, $e) | ||
{ | ||
if (($a && false === $b) || ! $c) { | ||
return ''; | ||
} | ||
if ($d) { | ||
return ''; | ||
} | ||
return $e; | ||
} | ||
} | ||
|
||
?> |
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
20 changes: 0 additions & 20 deletions
20
tests/Issues/IssueReturnBeforeElseIf/Fixture/skip_complex_if_cond_or.php.inc
This file was deleted.
Oops, something went wrong.