Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Add Equal and NotEqual support on SimplifyIfReturnBoolR…
…ector (#5697)
- Loading branch information
1 parent
7507136
commit 4a1880b
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
...s-tests/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector/Fixture/equal_not_equal.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,73 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector\Fixture; | ||
|
||
class EqualNotEqual | ||
{ | ||
public function notTrue($value) | ||
{ | ||
if ($value != '0') { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function notFalse($value) | ||
{ | ||
if ($value != '0') { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public function eqTrue($value) | ||
{ | ||
if ($value == '0') { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function eqFalse($value) | ||
{ | ||
if ($value == '0') { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector\Fixture; | ||
|
||
class EqualNotEqual | ||
{ | ||
public function notTrue($value) | ||
{ | ||
return $value != '0'; | ||
} | ||
|
||
public function notFalse($value) | ||
{ | ||
return $value == '0'; | ||
} | ||
|
||
public function eqTrue($value) | ||
{ | ||
return $value == '0'; | ||
} | ||
|
||
public function eqFalse($value) | ||
{ | ||
return $value != '0'; | ||
} | ||
} | ||
|
||
?> |
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