Skip to content

Commit 6e231c6

Browse files
committed
Updated Rector to commit 9ba9187fb327746383199a5924497539bced744d
rectorphp/rector-src@9ba9187 [CodingStyle] Deprecate StaticClosureRector and StaticArrowFunctionRector (#8092)
1 parent 7a96a27 commit 6e231c6

7 files changed

Lines changed: 13 additions & 90 deletions

File tree

rules/CodingStyle/Guard/StaticGuard.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,16 @@
55

66
use PhpParser\Node;
77
use PhpParser\Node\Expr\ArrowFunction;
8-
use Rector\CodingStyle\Guard\StaticGuard;
8+
use Rector\Configuration\Deprecation\Contract\DeprecatedInterface;
9+
use Rector\Exception\ShouldNotHappenException;
910
use Rector\Rector\AbstractRector;
1011
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1112
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
1213
/**
13-
* @see \Rector\Tests\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector\StaticArrowFunctionRectorTest
14+
* @deprecated as noisy change with little value. Use manually or custom rule where needed instead.
1415
*/
15-
final class StaticArrowFunctionRector extends AbstractRector
16+
final class StaticArrowFunctionRector extends AbstractRector implements DeprecatedInterface
1617
{
17-
/**
18-
* @readonly
19-
*/
20-
private StaticGuard $staticGuard;
21-
public function __construct(StaticGuard $staticGuard)
22-
{
23-
$this->staticGuard = $staticGuard;
24-
}
2518
public function getRuleDefinition(): RuleDefinition
2619
{
2720
return new RuleDefinition('Changes ArrowFunction to be static when possible', [new CodeSample(<<<'CODE_SAMPLE'
@@ -44,10 +37,6 @@ public function getNodeTypes(): array
4437
*/
4538
public function refactor(Node $node): ?Node
4639
{
47-
if (!$this->staticGuard->isLegal($node)) {
48-
return null;
49-
}
50-
$node->static = \true;
51-
return $node;
40+
throw new ShouldNotHappenException(sprintf('"%s" is deprecated as noisy change with little value. Use manually or custom rule where needed instead', self::class));
5241
}
5342
}

rules/CodingStyle/Rector/Closure/StaticClosureRector.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,16 @@
55

66
use PhpParser\Node;
77
use PhpParser\Node\Expr\Closure;
8-
use Rector\CodingStyle\Guard\StaticGuard;
9-
use Rector\NodeTypeResolver\Node\AttributeKey;
8+
use Rector\Configuration\Deprecation\Contract\DeprecatedInterface;
9+
use Rector\Exception\ShouldNotHappenException;
1010
use Rector\Rector\AbstractRector;
1111
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1212
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
1313
/**
14-
* @see \Rector\Tests\CodingStyle\Rector\Closure\StaticClosureRector\StaticClosureRectorTest
14+
* @deprecated as noisy change with little value. Use manually or custom rule where needed instead.
1515
*/
16-
final class StaticClosureRector extends AbstractRector
16+
final class StaticClosureRector extends AbstractRector implements DeprecatedInterface
1717
{
18-
/**
19-
* @readonly
20-
*/
21-
private StaticGuard $staticGuard;
22-
public function __construct(StaticGuard $staticGuard)
23-
{
24-
$this->staticGuard = $staticGuard;
25-
}
2618
public function getRuleDefinition(): RuleDefinition
2719
{
2820
return new RuleDefinition('Changes Closure to be static when possible', [new CodeSample(<<<'CODE_SAMPLE'
@@ -57,13 +49,6 @@ public function getNodeTypes(): array
5749
*/
5850
public function refactor(Node $node): ?Node
5951
{
60-
if ($node->hasAttribute(AttributeKey::IS_CLOSURE_USES_THIS)) {
61-
return null;
62-
}
63-
if (!$this->staticGuard->isLegal($node)) {
64-
return null;
65-
}
66-
$node->static = \true;
67-
return $node;
52+
throw new ShouldNotHappenException(sprintf('"%s" is deprecated as noisy change with little value. Use manually or custom rule where needed instead', self::class));
6853
}
6954
}

rules/Php81/Rector/ClassMethod/NewInInitializerRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getNodeTypes(): array
5151
*/
5252
public function refactor(Node $node): ?Node
5353
{
54-
throw new ShouldNotHappenException(sprintf('"%s" is deprecated as depends on context. Cannot be automated. Use manually where needed instead', self::class));
54+
throw new ShouldNotHappenException(sprintf('"%s" is deprecated as depends on context. Cannot be automated. Use manually or custom rule where needed instead', self::class));
5555
}
5656
public function provideMinPhpVersion(): int
5757
{

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '6dcc12669e87748c5c11607bb41580c61477fd35';
22+
public const PACKAGE_VERSION = '9ba9187fb327746383199a5924497539bced744d';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2026-06-27 17:14:24';
27+
public const RELEASE_DATE = '2026-06-27 21:43:46';
2828
/**
2929
* @var int
3030
*/

vendor/composer/autoload_classmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,6 @@
13011301
'Rector\\CodingStyle\\ClassNameImport\\ValueObject\\UsedImports' => $baseDir . '/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php',
13021302
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => $baseDir . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
13031303
'Rector\\CodingStyle\\Guard\\ArrowFunctionAndClosureFirstClassCallableGuard' => $baseDir . '/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php',
1304-
'Rector\\CodingStyle\\Guard\\StaticGuard' => $baseDir . '/rules/CodingStyle/Guard/StaticGuard.php',
13051304
'Rector\\CodingStyle\\Naming\\ClassNaming' => $baseDir . '/rules/CodingStyle/Naming/ClassNaming.php',
13061305
'Rector\\CodingStyle\\NodeAnalyzer\\UseImportNameMatcher' => $baseDir . '/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php',
13071306
'Rector\\CodingStyle\\NodeFactory\\ArrayCallableToMethodCallFactory' => $baseDir . '/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php',

vendor/composer/autoload_static.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,6 @@ class ComposerStaticInite7732782e781a0db6ef2f014a417d492
15661566
'Rector\\CodingStyle\\ClassNameImport\\ValueObject\\UsedImports' => __DIR__ . '/../..' . '/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php',
15671567
'Rector\\CodingStyle\\Contract\\ClassNameImport\\ClassNameImportSkipVoterInterface' => __DIR__ . '/../..' . '/rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php',
15681568
'Rector\\CodingStyle\\Guard\\ArrowFunctionAndClosureFirstClassCallableGuard' => __DIR__ . '/../..' . '/rules/CodingStyle/Guard/ArrowFunctionAndClosureFirstClassCallableGuard.php',
1569-
'Rector\\CodingStyle\\Guard\\StaticGuard' => __DIR__ . '/../..' . '/rules/CodingStyle/Guard/StaticGuard.php',
15701569
'Rector\\CodingStyle\\Naming\\ClassNaming' => __DIR__ . '/../..' . '/rules/CodingStyle/Naming/ClassNaming.php',
15711570
'Rector\\CodingStyle\\NodeAnalyzer\\UseImportNameMatcher' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php',
15721571
'Rector\\CodingStyle\\NodeFactory\\ArrayCallableToMethodCallFactory' => __DIR__ . '/../..' . '/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php',

0 commit comments

Comments
 (0)