mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
move FluentInterfaceClass to MagicDisclosure package
This commit is contained in:
parent
fae704b333
commit
4755ba8c88
@ -87,6 +87,7 @@
|
||||
"Rector\\JMS\\": "rules/jms/src",
|
||||
"Rector\\Laravel\\": "rules/laravel/src",
|
||||
"Rector\\Legacy\\": "rules/legacy/src",
|
||||
"Rector\\MagicDisclosure\\": "rules/magic-disclosure/src",
|
||||
"Rector\\MysqlToMysqli\\": "rules/mysql-to-mysqli/src",
|
||||
"Rector\\NetteTesterToPHPUnit\\": "rules/nette-tester-to-phpunit/src",
|
||||
"Rector\\NetteToSymfony\\": "rules/nette-to-symfony/src",
|
||||
@ -165,6 +166,7 @@
|
||||
"Rector\\JMS\\Tests\\": "rules/jms/tests",
|
||||
"Rector\\Laravel\\Tests\\": "rules/laravel/tests",
|
||||
"Rector\\Legacy\\Tests\\": "rules/legacy/tests",
|
||||
"Rector\\MagicDisclosure\\Tests\\": "rules/magic-disclosure/tests",
|
||||
"Rector\\MysqlToMysqli\\Tests\\": "rules/mysql-to-mysqli/tests",
|
||||
"Rector\\NetteTesterToPHPUnit\\Tests\\": "rules/nette-tester-to-phpunit/tests",
|
||||
"Rector\\NetteToSymfony\\Tests\\": "rules/nette-to-symfony/tests",
|
||||
|
@ -23,6 +23,7 @@
|
||||
- [JMS](#jms) (2)
|
||||
- [Laravel](#laravel) (6)
|
||||
- [Legacy](#legacy) (2)
|
||||
- [MagicDisclosure](#magicdisclosure) (1)
|
||||
- [MockistaToMockery](#mockistatomockery) (2)
|
||||
- [MysqlToMysqli](#mysqltomysqli) (4)
|
||||
- [Naming](#naming) (1)
|
||||
@ -4498,6 +4499,25 @@ Change functions to static calls, so composer can autoload them
|
||||
|
||||
<br><br>
|
||||
|
||||
## MagicDisclosure
|
||||
|
||||
### `DefluentMethodCallRector`
|
||||
|
||||
- class: [`Rector\MagicDisclosure\Rector\MethodCall\DefluentMethodCallRector`](/../master/rules/magic-disclosure/src/Rector/MethodCall/DefluentMethodCallRector.php)
|
||||
- [test fixtures](/../master/rules/magic-disclosure/tests/Rector/MethodCall/DefluentMethodCallRector/Fixture)
|
||||
|
||||
Turns fluent interface calls to classic ones.
|
||||
|
||||
```diff
|
||||
$someClass = new SomeClass();
|
||||
-$someClass->someFunction()
|
||||
- ->otherFunction();
|
||||
+$someClass->someFunction();
|
||||
+$someClass->otherFunction();
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
## MockistaToMockery
|
||||
|
||||
### `MockeryTearDownRector`
|
||||
@ -11220,7 +11240,7 @@ Change @return types and type from static analysis to type declarations if not a
|
||||
|
||||
## General
|
||||
|
||||
- [Core](#core) (44)
|
||||
- [Core](#core) (43)
|
||||
|
||||
## Core
|
||||
|
||||
@ -11592,23 +11612,6 @@ services:
|
||||
|
||||
<br><br>
|
||||
|
||||
### `DefluentMethodCallRector`
|
||||
|
||||
- class: [`Rector\Core\Rector\MethodCall\DefluentMethodCallRector`](/../master/src/Rector/MethodCall/DefluentMethodCallRector.php)
|
||||
- [test fixtures](/../master/tests/Rector/MethodCall/DefluentMethodCallRector/Fixture)
|
||||
|
||||
Turns fluent interface calls to classic ones.
|
||||
|
||||
```diff
|
||||
$someClass = new SomeClass();
|
||||
-$someClass->someFunction()
|
||||
- ->otherFunction();
|
||||
+$someClass->someFunction();
|
||||
+$someClass->otherFunction();
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
### `FunctionToMethodCallRector`
|
||||
|
||||
- class: [`Rector\Core\Rector\Function_\FunctionToMethodCallRector`](/../master/src/Rector/Function_/FunctionToMethodCallRector.php)
|
||||
|
10
rules/magic-disclosure/config/config.yaml
Normal file
10
rules/magic-disclosure/config/config.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
services:
|
||||
_defaults:
|
||||
public: true
|
||||
autowire: true
|
||||
|
||||
Rector\MagicDisclosure\:
|
||||
resource: '../src'
|
||||
exclude:
|
||||
- '../src/Rector/**/*Rector.php'
|
||||
- '../src/ValueObject/*'
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Rector\MethodCall;
|
||||
namespace Rector\MagicDisclosure\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
@ -19,7 +19,10 @@ use Rector\Core\ValueObject\AssignAndRootExpr;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
|
||||
/**
|
||||
* @see \Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\DefluentMethodCallRectorTest
|
||||
* @see https://ocramius.github.io/blog/fluent-interfaces-are-evil/
|
||||
* @see https://www.yegor256.com/2018/03/13/fluent-interfaces.html
|
||||
*
|
||||
* @see \Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\DefluentMethodCallRectorTest
|
||||
*/
|
||||
final class DefluentMethodCallRector extends AbstractRector
|
||||
{
|
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Core\Rector\MethodCall\DefluentMethodCallRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClassInterface;
|
||||
use Rector\MagicDisclosure\Rector\MethodCall\DefluentMethodCallRector;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClassInterface;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class DefluentMethodCallRectorTest extends AbstractRectorTestCase
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
|
||||
class ActionClass
|
||||
{
|
||||
@ -24,9 +24,9 @@ class ActionClass
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
|
||||
class ActionClass
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
@ -18,7 +18,7 @@ class MultipleSomeCommand extends Command
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use DateTime;
|
||||
use Symfony\Component\Console\Command\Command;
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\DifferentReturnValues;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\DifferentReturnValues;
|
||||
|
||||
class SkipDifferentType
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
@ -18,7 +18,7 @@ class SomeCommand extends Command
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
|
||||
class WithNew
|
||||
{
|
||||
@ -21,9 +21,9 @@ class WithNew
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Fixture;
|
||||
|
||||
use Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
use Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source\FluentInterfaceClass;
|
||||
|
||||
class WithNew
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
|
||||
final class DifferentReturnValues implements FluentInterfaceClassInterface
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
|
||||
final class FluentInterfaceClass implements FluentInterfaceClassInterface
|
||||
{
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\MagicDisclosure\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
|
||||
interface FluentInterfaceClassInterface
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Rector\MethodCall\DefluentMethodCallRector\Source;
|
||||
|
||||
interface FluentInterfaceClassInterface
|
||||
{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user