Skip to content

Commit

Permalink
Fix Return type Covariance Inverse Order (#1983)
Browse files Browse the repository at this point in the history
Fix Return type Covariance Inverse Order
  • Loading branch information
TomasVotruba authored Sep 15, 2019
2 parents 27ab83f + 82d2006 commit 371322d
Show file tree
Hide file tree
Showing 98 changed files with 562 additions and 509 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Return_;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php\ValueObject\PhpVersionFeature;
use Rector\PhpParser\Node\Manipulator\ForeachManipulator;
use Rector\Rector\AbstractRector;
use Rector\RectorDefinition\CodeSample;
Expand Down Expand Up @@ -71,7 +72,7 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
if (! $this->isAtLeastPhpVersion('7.0')) {
if (! $this->isAtLeastPhpVersion(PhpVersionFeature::NULL_COALESCE)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Return_;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Php\ValueObject\PhpVersionFeature;
use Rector\PhpParser\Node\Manipulator\IfManipulator;
use Rector\Rector\AbstractRector;
use Rector\RectorDefinition\CodeSample;
Expand Down Expand Up @@ -86,7 +87,7 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
if (! $this->isAtLeastPhpVersion('7.0')) {
if (! $this->isAtLeastPhpVersion(PhpVersionFeature::NULL_COALESCE)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyEmptyArrayCheckRector::class;
}

/**
* @return string[]
*/
Expand All @@ -29,4 +24,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture2.php.inc'];
yield [__DIR__ . '/Fixture/fixture3.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyEmptyArrayCheckRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return ForeachToInArrayRector::class;
}

/**
* @return string[]
*/
Expand All @@ -31,4 +26,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture4.php.inc'];
yield [__DIR__ . '/Fixture/skip_collections.php.inc'];
}

protected function getRectorClass(): string
{
return ForeachToInArrayRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyForeachToCoalescingRector::class;
}

/**
* @return string[]
*/
Expand All @@ -30,4 +25,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture3.php.inc'];
yield [__DIR__ . '/Fixture/foreach_key_value.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyForeachToCoalescingRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return InArrayAndArrayKeysToArrayKeyExistsRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return InArrayAndArrayKeysToArrayKeyExistsRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyFuncGetArgsCountRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyFuncGetArgsCountRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyInArrayValuesRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyInArrayValuesRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyStrposLowerRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyStrposLowerRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return GetClassToInstanceOfRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return GetClassToInstanceOfRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyArraySearchRector::class;
}

/**
* @return string[]
*/
Expand All @@ -28,4 +23,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture.php.inc'];
yield [__DIR__ . '/Fixture/fixture2.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyArraySearchRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyConditionsRector::class;
}

/**
* @return string[]
*/
Expand All @@ -30,4 +25,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture3.php.inc'];
yield [__DIR__ . '/Fixture/dual_null.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyConditionsRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyIfNotNullReturnRector::class;
}

/**
* @return string[]
*/
Expand All @@ -29,4 +24,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture2.php.inc'];
yield [__DIR__ . '/Fixture/skip.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyIfNotNullReturnRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyIfReturnBoolRector::class;
}

/**
* @return string[]
*/
Expand All @@ -36,4 +31,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture9.php.inc'];
yield [__DIR__ . '/Fixture/fixture10.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyIfReturnBoolRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimplifyUselessVariableRector::class;
}

/**
* @return string[]
*/
Expand All @@ -36,4 +31,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/in_a_function.php.inc'];
yield [__DIR__ . '/Fixture/keep_visual.php.inc'];
}

protected function getRectorClass(): string
{
return SimplifyUselessVariableRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return UnnecessaryTernaryExpressionRector::class;
}

/**
* @return string[]
*/
Expand All @@ -30,4 +25,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture3.php.inc'];
yield [__DIR__ . '/Fixture/fixture4.php.inc'];
}

protected function getRectorClass(): string
{
return UnnecessaryTernaryExpressionRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return SimpleArrayCallableToStringRector::class;
}

/**
* @return string[]
*/
public function provideDataForTest(): iterable
{
yield [__DIR__ . '/Fixture/fixture.php.inc'];
}

protected function getRectorClass(): string
{
return SimpleArrayCallableToStringRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ public function test(string $file): void
$this->doTestFile($file);
}

public function getRectorClass(): string
{
return IdenticalFalseToBooleanNotRector::class;
}

/**
* @return string[]
*/
Expand All @@ -28,4 +23,9 @@ public function provideDataForTest(): iterable
yield [__DIR__ . '/Fixture/fixture.php.inc'];
yield [__DIR__ . '/Fixture/skip_null_false.php.inc'];
}

protected function getRectorClass(): string
{
return IdenticalFalseToBooleanNotRector::class;
}
}
Loading

0 comments on commit 371322d

Please sign in to comment.