Skip to content

Commit

Permalink
Move DowngradeSelfTypeDeclarationRector to downgrade-php70 (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
devbanana committed Aug 8, 2021
1 parent b6f1b7d commit 5f4653c
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 39 deletions.
62 changes: 39 additions & 23 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 474 Rules Overview
# 475 Rules Overview

<br>

Expand All @@ -24,17 +24,17 @@

- [DowngradePhp53](#downgradephp53) (1)

- [DowngradePhp70](#downgradephp70) (9)
- [DowngradePhp70](#downgradephp70) (10)

- [DowngradePhp71](#downgradephp71) (9)

- [DowngradePhp72](#downgradephp72) (4)

- [DowngradePhp73](#downgradephp73) (6)

- [DowngradePhp74](#downgradephp74) (11)
- [DowngradePhp74](#downgradephp74) (10)

- [DowngradePhp80](#downgradephp80) (17)
- [DowngradePhp80](#downgradephp80) (18)

- [DowngradePhp81](#downgradephp81) (1)

Expand Down Expand Up @@ -4333,6 +4333,25 @@ Remove the type params and return type, add `@param` and `@return` tags instead

<br>

### DowngradeSelfTypeDeclarationRector

Remove "self" return type, add a `"@return` self" tag instead

- class: [`Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector`](../rules/DowngradePhp70/Rector/ClassMethod/DowngradeSelfTypeDeclarationRector.php)

```diff
class SomeClass
{
- public function foo(): self
+ public function foo()
{
return $this;
}
}
```

<br>

### DowngradeSessionStartArrayOptionsRector

Move array option of session_start($options) to before statement's `ini_set()`
Expand Down Expand Up @@ -5014,25 +5033,6 @@ Remove "_" as thousands separator in numbers

<br>

### DowngradeSelfTypeDeclarationRector

Remove "self" return type, add a `"@return` self" tag instead

- class: [`Rector\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector`](../rules/DowngradePhp74/Rector/ClassMethod/DowngradeSelfTypeDeclarationRector.php)

```diff
class SomeClass
{
- public function foo(): self
+ public function foo()
{
return $this;
}
}
```

<br>

### DowngradeStripTagsCallWithArrayRector

Convert 2nd param to `strip_tags` from array to string
Expand Down Expand Up @@ -5084,6 +5084,22 @@ Changes property type definition from type definitions to `@var` annotations.

## DowngradePhp80

### DowngradeAbstractPrivateMethodInTraitRector

Remove "abstract" from private methods in traits and adds an empty function body

- class: [`Rector\DowngradePhp80\Rector\ClassMethod\DowngradeAbstractPrivateMethodInTraitRector`](../rules/DowngradePhp80/Rector/ClassMethod/DowngradeAbstractPrivateMethodInTraitRector.php)

```diff
trait SomeTrait
{
- abstract private function someAbstractPrivateFunction();
+ private function someAbstractPrivateFunction() {}
}
```

<br>

### DowngradeAttributeToAnnotationRector

Refactor PHP attribute markers to annotations notation
Expand Down
2 changes: 2 additions & 0 deletions config/set/downgrade-php70.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\Coalesce\DowngradeNullCoalesceRector;
use Rector\DowngradePhp70\Rector\Declare_\DowngradeStrictTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\Expression\DowngradeDefineArrayConstantRector;
Expand All @@ -22,6 +23,7 @@
$services = $containerConfigurator->services();
$services->set(DowngradeScalarTypeDeclarationRector::class);
$services->set(DowngradeStrictTypeDeclarationRector::class);
$services->set(DowngradeSelfTypeDeclarationRector::class);
$services->set(DowngradeAnonymousClassRector::class);
$services->set(DowngradeNullCoalesceRector::class);
$services->set(DowngradeSpaceshipRector::class);
Expand Down
2 changes: 0 additions & 2 deletions config/set/downgrade-php74.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
Expand All @@ -32,5 +31,4 @@
$services->set(DowngradeArraySpreadRector::class);
$services->set(DowngradeArrayMergeCallWithoutArgumentsRector::class);
$services->set(DowngradeFreadFwriteFalsyToNegationRector::class);
$services->set(DowngradeSelfTypeDeclarationRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;

use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class DocblockExists {
/**
Expand All @@ -16,7 +16,7 @@ class DocblockExists {
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class DocblockExists {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class Fixture
{
Expand All @@ -14,7 +14,7 @@ class Fixture
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class Fixture
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

interface WithSelfInterface
{
Expand All @@ -11,7 +11,7 @@ interface WithSelfInterface
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

interface WithSelfInterface
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class NullableType
{
Expand All @@ -14,7 +14,7 @@ class NullableType
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

class NullableType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

trait WithSelfTrait
{
Expand All @@ -14,7 +14,7 @@ trait WithSelfTrait
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;

trait WithSelfTrait
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Rector\DowngradePhp74\Rector\ClassMethod;
namespace Rector\DowngradePhp70\Rector\ClassMethod;

use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
Expand All @@ -16,7 +16,7 @@
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

/**
* @see \Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\DowngradeSelfTypeDeclarationRectorTest
* @see \Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\DowngradeSelfTypeDeclarationRectorTest
*/
final class DowngradeSelfTypeDeclarationRector extends AbstractRector
{
Expand Down

0 comments on commit 5f4653c

Please sign in to comment.