mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
move PreferThisOrSelfMethodCall to CodingStyle
This commit is contained in:
parent
24ebc66747
commit
7d9c389748
@ -4242,13 +4242,13 @@ Changes pow(val, val2) to ** (exp) parameter
|
||||
|
||||
### `PreferThisOrSelfMethodCallRector`
|
||||
|
||||
- class: `Rector\Php\Rector\MethodCall\PreferThisOrSelfMethodCallRector`
|
||||
- class: `Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector`
|
||||
|
||||
Changes $this->... to self:: or vise versa for specific types
|
||||
|
||||
```yaml
|
||||
services:
|
||||
Rector\Php\Rector\MethodCall\PreferThisOrSelfMethodCallRector:
|
||||
Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector:
|
||||
PHPUnit\TestCase: self
|
||||
```
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php\Rector\MethodCall;
|
||||
namespace Rector\CodingStyle\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
@ -11,7 +11,7 @@ use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
|
||||
/**
|
||||
* @see \Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\PreferThisOrSelfMethodCallRectorTest
|
||||
* @see \Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\PreferThisOrSelfMethodCallRectorTest
|
||||
*/
|
||||
final class PreferThisOrSelfMethodCallRector extends AbstractRector
|
||||
{
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
|
||||
class ToSelf extends AbstractTestCase
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->assertThis();
|
||||
self::assertThis();
|
||||
parent::assertThis();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
|
||||
class ToSelf extends AbstractTestCase
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
self::assertThis();
|
||||
self::assertThis();
|
||||
parent::assertThis();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
|
||||
final class ToThis extends BeLocalClass
|
||||
{
|
||||
@ -19,9 +19,9 @@ final class ToThis extends BeLocalClass
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
|
||||
final class ToThis extends BeLocalClass
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
||||
|
||||
use Rector\Php\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
use Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
use Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\BeLocalClass;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class PreferThisOrSelfMethodCallRectorTest extends AbstractRectorTestCase
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source;
|
||||
|
||||
abstract class AbstractTestCase
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\CodingStyle\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source;
|
||||
|
||||
class BeLocalClass
|
||||
{
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
|
||||
class ToSelf extends AbstractTestCase
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->assertThis();
|
||||
self::assertThis();
|
||||
parent::assertThis();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source\AbstractTestCase;
|
||||
|
||||
class ToSelf extends AbstractTestCase
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
self::assertThis();
|
||||
self::assertThis();
|
||||
parent::assertThis();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source;
|
||||
|
||||
abstract class AbstractTestCase
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Php\Tests\Rector\MethodCall\PreferThisOrSelfMethodCallRector\Source;
|
||||
|
||||
class BeLocalClass
|
||||
{
|
||||
|
||||
}
|
8
packages/Php71/config/config.yaml
Normal file
8
packages/Php71/config/config.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
services:
|
||||
_defaults:
|
||||
public: true
|
||||
autowire: true
|
||||
|
||||
Rector\Php71\:
|
||||
resource: '../src'
|
||||
exclude: '../src/{Rector/**/*Rector.php}'
|
@ -14,7 +14,7 @@ use Rector\RectorDefinition\RectorDefinition;
|
||||
/**
|
||||
* @see https://wiki.php.net/rfc/object-typehint
|
||||
* @see https://github.com/cebe/yii2/commit/9548a212ecf6e50fcdb0e5ba6daad88019cfc544
|
||||
* @see \Rector\Php\Tests\Rector\Name\ReservedObjectRector\ReservedObjectRectorTest
|
||||
* @see \Rector\Php71\Tests\Rector\Name\ReservedObjectRector\ReservedObjectRectorTest
|
||||
*/
|
||||
final class ReservedObjectRector extends AbstractRector
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user