Skip to content

Commit e61e395

Browse files
committed
Updated Rector to commit 014b976b1989d40af977ba95bddf8bd63bd6eb94
rectorphp/rector-src@014b976 [CodeQuality] Skip used by other property hooks on InlineConstructorDefaultToPropertyRector (#7920)
1 parent 672a8e1 commit e61e395

6 files changed

Lines changed: 89 additions & 14 deletions

File tree

vendor/composer/installed.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,12 +1820,12 @@
18201820
"source": {
18211821
"type": "git",
18221822
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
1823-
"reference": "bf193a48c7d4fc34583b9ffe7330ef380d7b6deb"
1823+
"reference": "1aedbbcbb27d62b4af2b39f3edf8e532dedc58a0"
18241824
},
18251825
"dist": {
18261826
"type": "zip",
1827-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/bf193a48c7d4fc34583b9ffe7330ef380d7b6deb",
1828-
"reference": "bf193a48c7d4fc34583b9ffe7330ef380d7b6deb",
1827+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/1aedbbcbb27d62b4af2b39f3edf8e532dedc58a0",
1828+
"reference": "1aedbbcbb27d62b4af2b39f3edf8e532dedc58a0",
18291829
"shasum": ""
18301830
},
18311831
"require": {
@@ -1852,7 +1852,7 @@
18521852
"tomasvotruba\/unused-public": "^2.2",
18531853
"tracy\/tracy": "^2.11"
18541854
},
1855-
"time": "2026-03-04T08:17:44+00:00",
1855+
"time": "2026-03-04T13:24:00+00:00",
18561856
"default-branch": true,
18571857
"type": "rector-extension",
18581858
"extra": {
@@ -1884,12 +1884,12 @@
18841884
"source": {
18851885
"type": "git",
18861886
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
1887-
"reference": "a2ecd26af214193c9a10c0981552d77978ba90de"
1887+
"reference": "6f8031094466a0fb748524a8ba12a944d16579f7"
18881888
},
18891889
"dist": {
18901890
"type": "zip",
1891-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/a2ecd26af214193c9a10c0981552d77978ba90de",
1892-
"reference": "a2ecd26af214193c9a10c0981552d77978ba90de",
1891+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/6f8031094466a0fb748524a8ba12a944d16579f7",
1892+
"reference": "6f8031094466a0fb748524a8ba12a944d16579f7",
18931893
"shasum": ""
18941894
},
18951895
"require": {
@@ -1923,7 +1923,7 @@
19231923
"tomasvotruba\/unused-public": "^2.2",
19241924
"tracy\/tracy": "^2.11"
19251925
},
1926-
"time": "2026-02-20T09:08:25+00:00",
1926+
"time": "2026-03-06T15:13:30+00:00",
19271927
"default-branch": true,
19281928
"type": "rector-extension",
19291929
"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 7da017c'), '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 8c5e9e1'), '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 bf193a4'), '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 a2ecd26'));
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 7da017c'), '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 8c5e9e1'), '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 1aedbbc'), '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 6f80310'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/TypeWillReturnCallableArrowFunctionRector.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use PhpParser\Node\Expr\Variable;
1313
use PhpParser\Node\Scalar\String_;
1414
use PhpParser\Node\Stmt\Class_;
15+
use PhpParser\Node\Stmt\Return_;
16+
use PhpParser\NodeFinder;
1517
use PHPStan\Reflection\ClassReflection;
1618
use PHPStan\Type\IntersectionType;
1719
use PHPStan\Type\MixedType;
@@ -206,6 +208,9 @@ public function refactor(Node $node): ?Class_
206208
if (!$returnType instanceof Type) {
207209
return null;
208210
}
211+
if ($this->shouldSkipReturnForConflictWithReturnedNodeType($innerClosure, $returnType)) {
212+
return null;
213+
}
209214
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN);
210215
if ($returnTypeNode instanceof Node) {
211216
$innerClosure->returnType = $returnTypeNode;
@@ -275,4 +280,26 @@ private function fallbackMockedObjectInSetUp(Type $callerType, Expr $expr, array
275280
}
276281
return $callerType;
277282
}
283+
/**
284+
* @param \PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $functionLike
285+
*/
286+
private function shouldSkipReturnForConflictWithReturnedNodeType($functionLike, Type $returnType): bool
287+
{
288+
// find return functionLike, to check current type
289+
$nodeFinder = new NodeFinder();
290+
$returns = $nodeFinder->findInstanceOf($functionLike, Return_::class);
291+
$returnTypes = [];
292+
foreach ($returns as $return) {
293+
if ($return->expr instanceof Node) {
294+
$returnTypes[] = $this->getType($return->expr);
295+
}
296+
}
297+
if (count($returnTypes) === 1) {
298+
$closureReturnedNodeType = $returnTypes[0];
299+
if (!$closureReturnedNodeType->isSuperTypeOf($returnType)->yes()) {
300+
return \true;
301+
}
302+
}
303+
return \false;
304+
}
278305
}

vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/EventListenerToEventSubscriberRector.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ final class EventListenerToEventSubscriberRector extends AbstractRector
5050
* @var string
5151
*/
5252
private const LISTENER_MATCH_REGEX = '#^(.*?)(Listener)?$#';
53+
/**
54+
* @var string[]
55+
*/
56+
private const LISTENER_ATTRIBUTES = [
57+
SymfonyAttribute::AS_EVENT_LISTENER,
58+
// Symfony Workflow attributes (Symfony 7.1+)
59+
SymfonyAttribute::AS_ANNOUNCE_LISTENER,
60+
SymfonyAttribute::AS_COMPLETED_LISTENER,
61+
SymfonyAttribute::AS_ENTER_LISTENER,
62+
SymfonyAttribute::AS_ENTERED_LISTENER,
63+
SymfonyAttribute::AS_GUARD_LISTENER,
64+
SymfonyAttribute::AS_LEAVE_LISTENER,
65+
SymfonyAttribute::AS_TRANSITION_LISTENER,
66+
];
5367
/**
5468
* @var EventNameToClassAndConstant[]
5569
*/
@@ -155,18 +169,23 @@ private function changeListenerToSubscriberWithMethods(Class_ $class, array $eve
155169
}
156170
/**
157171
* @see https://symfony.com/doc/current/event_dispatcher.html#event-dispatcher_event-listener-attributes
172+
* @see https://symfony.com/doc/current/workflow.html
158173
*/
159174
private function hasAsListenerAttribute(Class_ $class): bool
160175
{
161-
if ($this->phpAttributeAnalyzer->hasPhpAttribute($class, SymfonyAttribute::AS_EVENT_LISTENER)) {
162-
return \true;
176+
foreach (self::LISTENER_ATTRIBUTES as $attribute) {
177+
if ($this->phpAttributeAnalyzer->hasPhpAttribute($class, $attribute)) {
178+
return \true;
179+
}
163180
}
164181
foreach ($class->getMethods() as $classMethod) {
165182
if (!$classMethod->isPublic()) {
166183
continue;
167184
}
168-
if ($this->phpAttributeAnalyzer->hasPhpAttribute($classMethod, SymfonyAttribute::AS_EVENT_LISTENER)) {
169-
return \true;
185+
foreach (self::LISTENER_ATTRIBUTES as $attribute) {
186+
if ($this->phpAttributeAnalyzer->hasPhpAttribute($classMethod, $attribute)) {
187+
return \true;
188+
}
170189
}
171190
}
172191
return \false;

vendor/rector/rector-symfony/src/Enum/SymfonyAttribute.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,35 @@ final class SymfonyAttribute
2525
* @var string
2626
*/
2727
public const AS_EVENT_LISTENER = 'Symfony\Component\EventDispatcher\Attribute\AsEventListener';
28+
// Workflow listener attributes (Symfony 7.1+)
29+
/**
30+
* @var string
31+
*/
32+
public const AS_ANNOUNCE_LISTENER = 'Symfony\Component\Workflow\Attribute\AsAnnounceListener';
33+
/**
34+
* @var string
35+
*/
36+
public const AS_COMPLETED_LISTENER = 'Symfony\Component\Workflow\Attribute\AsCompletedListener';
37+
/**
38+
* @var string
39+
*/
40+
public const AS_ENTER_LISTENER = 'Symfony\Component\Workflow\Attribute\AsEnterListener';
41+
/**
42+
* @var string
43+
*/
44+
public const AS_ENTERED_LISTENER = 'Symfony\Component\Workflow\Attribute\AsEnteredListener';
45+
/**
46+
* @var string
47+
*/
48+
public const AS_GUARD_LISTENER = 'Symfony\Component\Workflow\Attribute\AsGuardListener';
49+
/**
50+
* @var string
51+
*/
52+
public const AS_LEAVE_LISTENER = 'Symfony\Component\Workflow\Attribute\AsLeaveListener';
53+
/**
54+
* @var string
55+
*/
56+
public const AS_TRANSITION_LISTENER = 'Symfony\Component\Workflow\Attribute\AsTransitionListener';
2857
/**
2958
* @var string
3059
*/

0 commit comments

Comments
 (0)