mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 00:10:51 +00:00
[Php55] Move GetCalledClassToSelfClassRector + GetCalledClassToStaticClassRector from php 7.4 to 5.5 SetList (#1972)
This commit is contained in:
parent
90bbd4e1a0
commit
a20320d8ca
|
@ -54,7 +54,7 @@
|
|||
|
||||
- [Php54](#php54) (2)
|
||||
|
||||
- [Php55](#php55) (3)
|
||||
- [Php55](#php55) (5)
|
||||
|
||||
- [Php56](#php56) (2)
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
- [Php73](#php73) (9)
|
||||
|
||||
- [Php74](#php74) (16)
|
||||
- [Php74](#php74) (14)
|
||||
|
||||
- [Php80](#php80) (17)
|
||||
|
||||
|
@ -6740,6 +6740,44 @@ Change `__CLASS__` to self::class
|
|||
|
||||
<br>
|
||||
|
||||
### GetCalledClassToSelfClassRector
|
||||
|
||||
Change `get_called_class()` to self::class on final class
|
||||
|
||||
- class: [`Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector`](../rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
public function callOnMe()
|
||||
{
|
||||
- var_dump(get_called_class());
|
||||
+ var_dump(self::class);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### GetCalledClassToStaticClassRector
|
||||
|
||||
Change `get_called_class()` to static::class on non-final class
|
||||
|
||||
- class: [`Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector`](../rules/Php55/Rector/FuncCall/GetCalledClassToStaticClassRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function callOnMe()
|
||||
{
|
||||
- var_dump(get_called_class());
|
||||
+ var_dump(static::class);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### PregReplaceEModifierRector
|
||||
|
||||
The /e modifier is no longer supported, use preg_replace_callback instead
|
||||
|
@ -7837,44 +7875,6 @@ Change `filter_var()` with slash escaping to `addslashes()`
|
|||
|
||||
<br>
|
||||
|
||||
### GetCalledClassToSelfClassRector
|
||||
|
||||
Change `get_called_class()` to self::class on final class
|
||||
|
||||
- class: [`Rector\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector`](../rules/Php74/Rector/FuncCall/GetCalledClassToSelfClassRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
public function callOnMe()
|
||||
{
|
||||
- var_dump(get_called_class());
|
||||
+ var_dump(self::class);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### GetCalledClassToStaticClassRector
|
||||
|
||||
Change `get_called_class()` to static::class on non-final class
|
||||
|
||||
- class: [`Rector\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector`](../rules/Php74/Rector/FuncCall/GetCalledClassToStaticClassRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function callOnMe()
|
||||
{
|
||||
- var_dump(get_called_class());
|
||||
+ var_dump(static::class);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MbStrrposEncodingArgumentPositionRector
|
||||
|
||||
Change `mb_strrpos()` encoding argument position
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\PregReplaceEModifierRector;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
@ -12,4 +14,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(StringClassNameToClassConstantRector::class);
|
||||
$services->set(ClassConstantToSelfClassRector::class);
|
||||
$services->set(PregReplaceEModifierRector::class);
|
||||
$services->set(GetCalledClassToSelfClassRector::class);
|
||||
$services->set(GetCalledClassToStaticClassRector::class);
|
||||
};
|
||||
|
|
|
@ -9,8 +9,6 @@ use Rector\Php74\Rector\Double\RealToFloatTypeCastRector;
|
|||
use Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
|
||||
use Rector\Php74\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
|
||||
use Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector;
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
|
||||
use Rector\Php74\Rector\Function_\ReservedFnFunctionRector;
|
||||
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
|
||||
|
@ -42,10 +40,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
$services->set(ExportToReflectionFunctionRector::class);
|
||||
|
||||
$services->set(GetCalledClassToSelfClassRector::class);
|
||||
|
||||
$services->set(GetCalledClassToStaticClassRector::class);
|
||||
|
||||
$services->set(MbStrrposEncodingArgumentPositionRector::class);
|
||||
|
||||
$services->set(RealToFloatTypeCastRector::class);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
new class {
|
||||
public function callOnMe()
|
||||
|
@ -13,7 +13,7 @@ new class {
|
|||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
new class {
|
||||
public function callOnMe()
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
final class Fixture
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ final class Fixture
|
|||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
final class Fixture
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
class SkipOnNonFinalClass
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\Fixture;
|
||||
|
||||
trait SkipTrait
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ class Fixture
|
|||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
new class {
|
||||
public function callOnMe()
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
final class SkipOnFinalClass
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
trait SomeTrait
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ trait SomeTrait
|
|||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\Fixture;
|
||||
|
||||
trait SomeTrait
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
namespace Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php74\Rector\FuncCall;
|
||||
namespace Rector\Php55\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -16,9 +16,9 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
/**
|
||||
* @changelog https://wiki.php.net/rfc/deprecations_php_7_4 (not confirmed yet)
|
||||
* @changelog https://www.php.net/ChangeLog-5.php#5.5.0
|
||||
* @see https://3v4l.org/GU9dP
|
||||
* @see \Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector\GetCalledClassToSelfClassRectorTest
|
||||
* @see \Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector\GetCalledClassToSelfClassRectorTest
|
||||
*/
|
||||
final class GetCalledClassToSelfClassRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php74\Rector\FuncCall;
|
||||
namespace Rector\Php55\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -16,9 +16,9 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
||||
/**
|
||||
* @changelog https://wiki.php.net/rfc/deprecations_php_7_4 (not confirmed yet)
|
||||
* @changelog https://www.php.net/ChangeLog-5.php#5.5.0
|
||||
* @see https://3v4l.org/dJgXd
|
||||
* @see \Rector\Tests\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector\GetCalledClassToStaticClassRectorTest
|
||||
* @see \Rector\Tests\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector\GetCalledClassToStaticClassRectorTest
|
||||
*/
|
||||
final class GetCalledClassToStaticClassRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php74\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
|
||||
use Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
|
Loading…
Reference in New Issue
Block a user