Move DowngradeSelfTypeDeclarationRector to downgrade-php70 (#623)

This commit is contained in:
Brandon Olivares 2021-08-08 15:53:24 -04:00 committed by GitHub
parent b6f1b7d9f0
commit 5f4653c9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 39 deletions

View File

@ -1,4 +1,4 @@
# 474 Rules Overview
# 475 Rules Overview
<br>
@ -24,7 +24,7 @@
- [DowngradePhp53](#downgradephp53) (1)
- [DowngradePhp70](#downgradephp70) (9)
- [DowngradePhp70](#downgradephp70) (10)
- [DowngradePhp71](#downgradephp71) (9)
@ -32,9 +32,9 @@
- [DowngradePhp73](#downgradephp73) (6)
- [DowngradePhp74](#downgradephp74) (11)
- [DowngradePhp74](#downgradephp74) (10)
- [DowngradePhp80](#downgradephp80) (17)
- [DowngradePhp80](#downgradephp80) (18)
- [DowngradePhp81](#downgradephp81) (1)
@ -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()`
@ -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
@ -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

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
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;
@ -22,6 +23,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$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);

View File

@ -8,7 +8,6 @@ use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
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;
@ -32,5 +31,4 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services->set(DowngradeArraySpreadRector::class);
$services->set(DowngradeArrayMergeCallWithoutArgumentsRector::class);
$services->set(DowngradeFreadFwriteFalsyToNegationRector::class);
$services->set(DowngradeSelfTypeDeclarationRector::class);
};

View File

@ -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;

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
class DocblockExists {
/**
@ -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 {
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
class Fixture
{
@ -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
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
interface WithSelfInterface
{
@ -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
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
class NullableType
{
@ -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
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\DowngradePhp74\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
namespace Rector\Tests\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector\Fixture;
trait WithSelfTrait
{
@ -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
{

View File

@ -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 {

View File

@ -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;
@ -16,7 +16,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
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
{