Skip to content

Commit

Permalink
merge SimplifyDuplicatedTernaryRector to UnnecessaryTernaryExpression…
Browse files Browse the repository at this point in the history
…Rector, almost identical rule (#2046)
  • Loading branch information
TomasVotruba authored Apr 10, 2022
1 parent a2ee46d commit 9b8e161
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 135 deletions.
2 changes: 0 additions & 2 deletions config/set/code-quality.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
use Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector;
use Rector\CodeQuality\Rector\Switch_\SingularSwitchToIfRector;
use Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector;
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
Expand Down Expand Up @@ -110,7 +109,6 @@
$services->set(ExplicitBoolCompareRector::class);
$services->set(CombineIfRector::class);
$services->set(UseIdenticalOverEqualWithSameTypeRector::class);
$services->set(SimplifyDuplicatedTernaryRector::class);
$services->set(SimplifyBoolIdenticalTrueRector::class);
$services->set(SimplifyRegexPatternRector::class);
$services->set(BooleanNotIdenticalToNotIdenticalRector::class);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Rector\Tests\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector\Fixture;
namespace Rector\Tests\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector\Fixture;

class Fixture
final class SimpleExample
{
public function run(bool $value, string $name)
{
Expand All @@ -15,14 +15,14 @@ class Fixture
-----
<?php

namespace Rector\Tests\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector\Fixture;
namespace Rector\Tests\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector\Fixture;

class Fixture
final class SimpleExample
{
public function run(bool $value, string $name)
{
$isTrue = $value;
$isName = $name ? true : false;
$isName = (bool) $name;
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Remove unnecessary ternary expressions.',
'Remove unnecessary ternary expressions',
[new CodeSample('$foo === $bar ? true : false;', '$foo === $bar;')]
);
}
Expand Down

0 comments on commit 9b8e161

Please sign in to comment.