-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Fix tautology transformation on identical check on Simp…
…lifyTautologyTernaryRector (#5854) * SimplifyTautologyTernaryRector breaks logic * rename fixture * fixture fix * update fixture * more fixture --------- Co-authored-by: kkmuffme <11071985+kkmuffme@users.noreply.github.com>
- Loading branch information
1 parent
c7d2ca3
commit 6525345
Showing
3 changed files
with
53 additions
and
4 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
51 changes: 51 additions & 0 deletions
51
...lity/Rector/Ternary/SimplifyTautologyTernaryRector/Fixture/identical_compare_left.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,51 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector\Fixture; | ||
|
||
final class IdenticalCompareLeft | ||
{ | ||
public function run(string $param) | ||
{ | ||
$foo = $this->bar($param) === '' ? '' : $this->bar($param); | ||
echo 'asd' . $foo . 'def'; | ||
} | ||
|
||
public function run2(string $param) | ||
{ | ||
$foo = '' === $this->bar($param) ? '' : $this->bar($param); | ||
echo 'asd' . $foo . 'def'; | ||
} | ||
|
||
private function bar(string $value) | ||
{ | ||
return trim($value); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector\Fixture; | ||
|
||
final class IdenticalCompareLeft | ||
{ | ||
public function run(string $param) | ||
{ | ||
$foo = $this->bar($param); | ||
echo 'asd' . $foo . 'def'; | ||
} | ||
|
||
public function run2(string $param) | ||
{ | ||
$foo = $this->bar($param); | ||
echo 'asd' . $foo . 'def'; | ||
} | ||
|
||
private function bar(string $value) | ||
{ | ||
return trim($value); | ||
} | ||
} | ||
|
||
?> |
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