Skip to content

Commit 1b8206a

Browse files
committed
decouple ClosureDelegatingCallToFirstClassCallableRector, deprecate FunctionLikeToFirstClassCallableRector as split into 2 rules now
1 parent 17eb5f4 commit 1b8206a

File tree

72 files changed

+557
-617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+557
-617
lines changed

config/set/php81.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector;
5+
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
6+
use Rector\CodingStyle\Rector\Closure\ClosureDelegatingCallToFirstClassCallableRector;
67
use Rector\CodingStyle\Rector\FuncCall\ClosureFromCallableToFirstClassCallableRector;
78
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
8-
use Rector\CodingStyle\Rector\FunctionLike\FunctionLikeToFirstClassCallableRector;
99
use Rector\Config\RectorConfig;
1010
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
1111
use Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector;
@@ -31,13 +31,13 @@
3131
SpatieEnumMethodCallToEnumConstRector::class,
3232
NullToStrictStringFuncCallArgRector::class,
3333
NullToStrictIntPregSlitFuncCallLimitArgRector::class,
34-
// array of local method call
34+
3535
ArrayToFirstClassCallableRector::class,
3636

3737
// closure/arrow function
38-
ArrowFunctionToFirstClassCallableRector::class,
38+
ArrowFunctionDelegatingCallToFirstClassCallableRector::class,
39+
ClosureDelegatingCallToFirstClassCallableRector::class,
3940

40-
FunctionLikeToFirstClassCallableRector::class,
4141
ClosureFromCallableToFirstClassCallableRector::class,
4242
FunctionFirstClassCallableRector::class,
4343
RemoveReflectionSetAccessibleCallsRector::class,

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/ArrowFunctionToFirstClassCallableRectorTest.php renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/ArrowFunctionDelegatingCallToFirstClassCallableRectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector;
5+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
66

77
use Iterator;
88
use PHPUnit\Framework\Attributes\DataProvider;
99
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
1010

11-
final class ArrowFunctionToFirstClassCallableRectorTest extends AbstractRectorTestCase
11+
final class ArrowFunctionDelegatingCallToFirstClassCallableRectorTest extends AbstractRectorTestCase
1212
{
1313
#[DataProvider('provideData')]
1414
public function test(string $filePath): void

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/array_map.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/array_map.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

55
final class ArrayMap
66
{
@@ -26,7 +26,7 @@ final class ArrayMap
2626
-----
2727
<?php
2828

29-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
29+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
3030

3131
final class ArrayMap
3232
{

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/exists_both_in_method_doc_and_native_method.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/exists_both_in_method_doc_and_native_method.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

55
/**
66
* @method static array test(mixed $value)
@@ -22,7 +22,7 @@ class ExistsBothInMethodDocAndNativeMethod
2222
-----
2323
<?php
2424

25-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
25+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
2626

2727
/**
2828
* @method static array test(mixed $value)

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/multiple_params.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/multiple_params.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

55
final class MultipleParams
66
{
@@ -14,7 +14,7 @@ final class MultipleParams
1414
-----
1515
<?php
1616

17-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
17+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
1818

1919
final class MultipleParams
2020
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
4+
5+
use Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Source\FooBar;
6+
7+
final class SimpleCall
8+
{
9+
public function run()
10+
{
11+
fn ($foo) => FooBar::foo($foo);
12+
}
13+
}
14+
15+
?>
16+
-----
17+
<?php
18+
19+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
20+
21+
use Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Source\FooBar;
22+
23+
final class SimpleCall
24+
{
25+
public function run()
26+
{
27+
FooBar::foo(...);
28+
}
29+
}
30+
31+
?>

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/skip_assigned_early.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/skip_assigned_early.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

55
final readonly class SkipAssignedEarly {
66
public function __construct(private string $name, private object $object) {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
4+
5+
final class SkipDependencyOnArg
6+
{
7+
public function run()
8+
{
9+
fn ($foo) => $foo->foo();
10+
}
11+
}

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/skip_callable_param_assign_with_signature_multi_params.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/skip_callable_param_assign_with_signature_multi_params.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

55
class SkipCallableParamAssignWithSignatureMultiParams
66
{

rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionToFirstClassCallableRector/Fixture/skip_callable_param_union.php.inc renamed to rules-tests/CodingStyle/Rector/ArrowFunction/ArrowFunctionDelegatingCallToFirstClassCallableRector/Fixture/skip_callable_param_union.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Fixture;
3+
namespace Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Fixture;
44

5-
use Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionToFirstClassCallableRector\Source\SomeCacheInterface;
5+
use Rector\Tests\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector\Source\SomeCacheInterface;
66

77
class SkipCallableParamUnion {
88
public function __construct(

0 commit comments

Comments
 (0)