Skip to content

Commit 15e78fa

Browse files
committed
Updated Rector to commit c208a96263ef623873ef92658cfdec3ceba81710
rectorphp/rector-src@c208a96 restore removing unused imports in rector config
1 parent 82e7d64 commit 15e78fa

File tree

8 files changed

+35
-65
lines changed

8 files changed

+35
-65
lines changed

vendor/composer/autoload_classmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,6 @@
18071807
'Rector\\PHPUnit\\CodeQuality\\Rector\\FuncCall\\AssertFuncCallToPHPUnitAssertRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector.php',
18081808
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertCompareOnCountableWithMethodToAssertCountRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php',
18091809
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertComparisonToSpecificMethodRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php',
1810-
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertCountWithZeroToAssertEmptyRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCountWithZeroToAssertEmptyRector.php',
18111810
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEmptyNullableObjectToAssertInstanceofRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php',
18121811
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php',
18131812
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEqualsToSameRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php',

vendor/composer/autoload_static.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,6 @@ class ComposerStaticInit85a5c971754a67e64efb2b2dadc9a1fe
20262026
'Rector\\PHPUnit\\CodeQuality\\Rector\\FuncCall\\AssertFuncCallToPHPUnitAssertRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/FuncCall/AssertFuncCallToPHPUnitAssertRector.php',
20272027
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertCompareOnCountableWithMethodToAssertCountRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php',
20282028
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertComparisonToSpecificMethodRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php',
2029-
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertCountWithZeroToAssertEmptyRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCountWithZeroToAssertEmptyRector.php',
20302029
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEmptyNullableObjectToAssertInstanceofRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php',
20312030
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php',
20322031
'Rector\\PHPUnit\\CodeQuality\\Rector\\MethodCall\\AssertEqualsToSameRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php',

vendor/composer/installed.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,12 +1804,12 @@
18041804
"source": {
18051805
"type": "git",
18061806
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
1807-
"reference": "ab9e38391d36c3cf343c4a9c35954f4de801d788"
1807+
"reference": "27f53d05bc0d308c0d9079417f59d68374765e8d"
18081808
},
18091809
"dist": {
18101810
"type": "zip",
1811-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/ab9e38391d36c3cf343c4a9c35954f4de801d788",
1812-
"reference": "ab9e38391d36c3cf343c4a9c35954f4de801d788",
1811+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/27f53d05bc0d308c0d9079417f59d68374765e8d",
1812+
"reference": "27f53d05bc0d308c0d9079417f59d68374765e8d",
18131813
"shasum": ""
18141814
},
18151815
"require": {
@@ -1833,7 +1833,7 @@
18331833
"tomasvotruba\/class-leak": "^1.2",
18341834
"tracy\/tracy": "^2.10"
18351835
},
1836-
"time": "2025-05-02T14:46:04+00:00",
1836+
"time": "2025-05-02T22:30:02+00:00",
18371837
"default-branch": true,
18381838
"type": "rector-extension",
18391839
"extra": {
@@ -1866,12 +1866,12 @@
18661866
"source": {
18671867
"type": "git",
18681868
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
1869-
"reference": "b3a4192e97a4ea787becb19929902897a5d6e4d6"
1869+
"reference": "d623cf211ffe859808cde1452e1b974a98817559"
18701870
},
18711871
"dist": {
18721872
"type": "zip",
1873-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b3a4192e97a4ea787becb19929902897a5d6e4d6",
1874-
"reference": "b3a4192e97a4ea787becb19929902897a5d6e4d6",
1873+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/d623cf211ffe859808cde1452e1b974a98817559",
1874+
"reference": "d623cf211ffe859808cde1452e1b974a98817559",
18751875
"shasum": ""
18761876
},
18771877
"require": {
@@ -1899,7 +1899,7 @@
18991899
"tomasvotruba\/unused-public": "^2.0",
19001900
"tracy\/tracy": "^2.10"
19011901
},
1902-
"time": "2025-04-24T10:45:36+00:00",
1902+
"time": "2025-05-02T23:24:23+00:00",
19031903
"default-branch": true,
19041904
"type": "rector-extension",
19051905
"extra": {

vendor/composer/installed.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

vendor/rector/extension-installer/src/GeneratedConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
final class GeneratedConfig
1111
{
12-
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c2dac7b'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2b141c8'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main ab9e383'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b3a4192'));
12+
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c2dac7b'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2b141c8'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 27f53d0'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main d623cf2'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCountWithZeroToAssertEmptyRector.php

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

vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php

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

66
use PhpParser\Node;
77
use PhpParser\Node\Stmt\Class_;
8+
use PHPStan\Reflection\ReflectionProvider;
9+
use PHPStan\Type\ObjectType;
810
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
911
use Rector\Rector\AbstractRector;
1012
use Rector\Symfony\Helper\MessengerHelper;
11-
use Rector\Symfony\NodeAnalyzer\ClassAnalyzer;
1213
use Rector\Symfony\NodeManipulator\ClassManipulator;
1314
use Rector\Symfony\ValueObject\ServiceDefinition;
1415
use Rector\ValueObject\PhpVersionFeature;
@@ -31,17 +32,17 @@ final class MessageHandlerInterfaceToAttributeRector extends AbstractRector impl
3132
/**
3233
* @readonly
3334
*/
34-
private ClassAnalyzer $classAnalyzer;
35+
private PhpAttributeAnalyzer $phpAttributeAnalyzer;
3536
/**
3637
* @readonly
3738
*/
38-
private PhpAttributeAnalyzer $phpAttributeAnalyzer;
39-
public function __construct(MessengerHelper $messengerHelper, ClassManipulator $classManipulator, ClassAnalyzer $classAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer)
39+
private ReflectionProvider $reflectionProvider;
40+
public function __construct(MessengerHelper $messengerHelper, ClassManipulator $classManipulator, PhpAttributeAnalyzer $phpAttributeAnalyzer, ReflectionProvider $reflectionProvider)
4041
{
4142
$this->messengerHelper = $messengerHelper;
4243
$this->classManipulator = $classManipulator;
43-
$this->classAnalyzer = $classAnalyzer;
4444
$this->phpAttributeAnalyzer = $phpAttributeAnalyzer;
45+
$this->reflectionProvider = $reflectionProvider;
4546
}
4647
public function provideMinPhpVersion() : int
4748
{
@@ -86,17 +87,26 @@ public function getNodeTypes() : array
8687
*/
8788
public function refactor(Node $node) : ?Node
8889
{
90+
if (!$this->reflectionProvider->hasClass(MessengerHelper::AS_MESSAGE_HANDLER_ATTRIBUTE)) {
91+
return null;
92+
}
8993
if ($this->phpAttributeAnalyzer->hasPhpAttribute($node, MessengerHelper::AS_MESSAGE_HANDLER_ATTRIBUTE)) {
9094
return null;
9195
}
92-
if (!$this->classAnalyzer->hasImplements($node, MessengerHelper::MESSAGE_HANDLER_INTERFACE)) {
96+
$classType = $this->getType($node);
97+
$messageHandlerObjectType = new ObjectType(MessengerHelper::MESSAGE_HANDLER_INTERFACE);
98+
if (!$messageHandlerObjectType->isSuperTypeOf($classType)->yes()) {
9399
$handlers = $this->messengerHelper->getHandlersFromServices();
94100
if ($handlers === []) {
95101
return null;
96102
}
97103
return $this->checkForServices($node, $handlers);
98104
}
99105
$this->classManipulator->removeImplements($node, [MessengerHelper::MESSAGE_HANDLER_INTERFACE]);
106+
// no need to add the attribute
107+
if ($node->isAbstract()) {
108+
return $node;
109+
}
100110
return $this->messengerHelper->addAttribute($node);
101111
}
102112
/**

vendor/rector/rector-symfony/src/Helper/MessengerHelper.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ final class MessengerHelper
3030
public const MESSAGE_SUBSCRIBER_INTERFACE = 'Symfony\\Component\\Messenger\\Handler\\MessageSubscriberInterface';
3131
public const AS_MESSAGE_HANDLER_ATTRIBUTE = 'Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler';
3232
private string $messengerTagName = 'messenger.message_handler';
33+
/**
34+
* @var ServiceDefinition[]
35+
*/
36+
private array $handlersFromServices = [];
3337
public function __construct(PhpAttributeGroupFactory $phpAttributeGroupFactory, AttributeArrayNameInliner $attributeArrayNameInliner, ServiceMapProvider $serviceMapProvider)
3438
{
3539
$this->phpAttributeGroupFactory = $phpAttributeGroupFactory;
@@ -58,8 +62,12 @@ public function extractOptionsFromServiceDefinition(ServiceDefinition $serviceDe
5862
*/
5963
public function getHandlersFromServices() : array
6064
{
65+
if ($this->handlersFromServices !== []) {
66+
return $this->handlersFromServices;
67+
}
6168
$serviceMap = $this->serviceMapProvider->provide();
62-
return $serviceMap->getServicesByTag($this->messengerTagName);
69+
$this->handlersFromServices = $serviceMap->getServicesByTag($this->messengerTagName);
70+
return $this->handlersFromServices;
6371
}
6472
/**
6573
* @param array<string, mixed> $options

0 commit comments

Comments
 (0)