Skip to content

Commit 8dcb063

Browse files
committed
Updated Rector to commit d1ff945497efbdfca534b33443d4ac323dd3d9e3
rectorphp/rector-src@d1ff945 Fix rector-symfony phpunit (#7772)
1 parent 97f1dcf commit 8dcb063

File tree

8 files changed

+41
-92
lines changed

8 files changed

+41
-92
lines changed

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 = 'f891bb6635642690ec64e4f9d78299ef8ea89af7';
22+
public const PACKAGE_VERSION = 'd1ff945497efbdfca534b33443d4ac323dd3d9e3';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-12-22 16:27:27';
27+
public const RELEASE_DATE = '2025-12-22 22:57:45';
2828
/**
2929
* @var int
3030
*/

src/PostRector/Application/PostFileProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function getPostRectors(): array
112112
$isRemovingUnusedImportsEnabled = SimpleParameterProvider::provideBoolParameter(Option::REMOVE_UNUSED_IMPORTS);
113113
$postRectors = [];
114114
// sorted by priority, to keep removed imports in order
115-
if ($isRenamedClassEnabled) {
115+
if ($isRenamedClassEnabled && $isNameImportingEnabled) {
116116
$postRectors[] = $this->classRenamingPostRector;
117117
}
118118
// import names

vendor/composer/installed.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,12 +1694,12 @@
16941694
"source": {
16951695
"type": "git",
16961696
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
1697-
"reference": "5159e01e642e967f52d09783bc38ae2ff925fe44"
1697+
"reference": "77404942637be548cabc73eb8d5e638885cad63e"
16981698
},
16991699
"dist": {
17001700
"type": "zip",
1701-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/5159e01e642e967f52d09783bc38ae2ff925fe44",
1702-
"reference": "5159e01e642e967f52d09783bc38ae2ff925fe44",
1701+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/77404942637be548cabc73eb8d5e638885cad63e",
1702+
"reference": "77404942637be548cabc73eb8d5e638885cad63e",
17031703
"shasum": ""
17041704
},
17051705
"require": {
@@ -1724,7 +1724,7 @@
17241724
"tomasvotruba\/class-leak": "^2.1",
17251725
"tracy\/tracy": "^2.11"
17261726
},
1727-
"time": "2025-12-22T13:38:13+00:00",
1727+
"time": "2025-12-22T15:39:28+00:00",
17281728
"default-branch": true,
17291729
"type": "rector-extension",
17301730
"extra": {
@@ -1814,12 +1814,12 @@
18141814
"source": {
18151815
"type": "git",
18161816
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
1817-
"reference": "6d2b1ba20955452b8f3e82b3a480b061879c4448"
1817+
"reference": "4fa695bb3055352e94cf93989682e99e6f5ba786"
18181818
},
18191819
"dist": {
18201820
"type": "zip",
1821-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/6d2b1ba20955452b8f3e82b3a480b061879c4448",
1822-
"reference": "6d2b1ba20955452b8f3e82b3a480b061879c4448",
1821+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/4fa695bb3055352e94cf93989682e99e6f5ba786",
1822+
"reference": "4fa695bb3055352e94cf93989682e99e6f5ba786",
18231823
"shasum": ""
18241824
},
18251825
"require": {
@@ -1845,7 +1845,7 @@
18451845
"tomasvotruba\/class-leak": "^1.2",
18461846
"tracy\/tracy": "^2.11"
18471847
},
1848-
"time": "2025-12-17T07:45:19+00:00",
1848+
"time": "2025-12-22T15:37:51+00:00",
18491849
"default-branch": true,
18501850
"type": "rector-extension",
18511851
"extra": {
@@ -1877,12 +1877,12 @@
18771877
"source": {
18781878
"type": "git",
18791879
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
1880-
"reference": "757db77d4505ae7ff2fff5e35c5494fd7b428c82"
1880+
"reference": "8f390b11611c71255d25d03b514955aeede1be94"
18811881
},
18821882
"dist": {
18831883
"type": "zip",
1884-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/757db77d4505ae7ff2fff5e35c5494fd7b428c82",
1885-
"reference": "757db77d4505ae7ff2fff5e35c5494fd7b428c82",
1884+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/8f390b11611c71255d25d03b514955aeede1be94",
1885+
"reference": "8f390b11611c71255d25d03b514955aeede1be94",
18861886
"shasum": ""
18871887
},
18881888
"require": {
@@ -1914,7 +1914,7 @@
19141914
"tomasvotruba\/unused-public": "^2.1",
19151915
"tracy\/tracy": "^2.11"
19161916
},
1917-
"time": "2025-12-20T15:00:25+00:00",
1917+
"time": "2025-12-22T15:36:29+00:00",
19181918
"default-branch": true,
19191919
"type": "rector-extension",
19201920
"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 5159e01'), '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 7640420'), '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 6d2b1ba'), '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 757db77'));
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 7740494'), '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 7640420'), '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 4fa695b'), '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 8f390b1'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-phpunit/rules/CodeQuality/Rector/StmtsAwareInterface/DeclareStrictTypesTestsRector.php

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@
77
use PhpParser\Node\Stmt;
88
use PhpParser\Node\Stmt\Class_;
99
use PhpParser\Node\Stmt\Nop;
10-
use Rector\ChangesReporting\ValueObject\RectorWithLineChange;
1110
use Rector\Contract\Rector\HTMLAverseRectorInterface;
12-
use Rector\PhpParser\Enum\NodeGroup;
1311
use Rector\PhpParser\Node\BetterNodeFinder;
14-
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
12+
use Rector\PhpParser\Node\FileNode;
1513
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
1614
use Rector\Rector\AbstractRector;
1715
use Rector\TypeDeclaration\NodeAnalyzer\DeclareStrictTypeFinder;
18-
use Rector\ValueObject\Application\File;
1916
use Rector\ValueObject\PhpVersion;
2017
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
2118
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -69,82 +66,34 @@ public function test()
6966
CODE_SAMPLE
7067
)]);
7168
}
72-
/**
73-
* @param Stmt[] $nodes
74-
* @return Stmt[]|null
75-
*/
76-
public function beforeTraverse(array $nodes): ?array
77-
{
78-
parent::beforeTraverse($nodes);
79-
if ($this->file->containsHTML()) {
80-
return null;
81-
}
82-
if ($this->shouldSkipNodes($nodes, $this->file)) {
83-
return null;
84-
}
85-
/** @var Node $rootStmt */
86-
$rootStmt = current($nodes);
87-
// when first stmt is Declare_, verify if there is strict_types definition already,
88-
// as multiple declare is allowed, with declare(strict_types=1) only allowed on very first stmt
89-
if ($rootStmt instanceof FileWithoutNamespace) {
90-
$currentNode = current($rootStmt->stmts);
91-
if (!$currentNode instanceof Stmt) {
92-
return null;
93-
}
94-
if ($this->declareStrictTypeFinder->hasDeclareStrictTypes($currentNode)) {
95-
return null;
96-
}
97-
} elseif ($this->declareStrictTypeFinder->hasDeclareStrictTypes($rootStmt)) {
98-
return null;
99-
}
100-
if (!$this->hasPHPUnitTestClass($nodes)) {
101-
return null;
102-
}
103-
$rectorWithLineChange = new RectorWithLineChange(self::class, $rootStmt->getStartLine());
104-
$this->file->addRectorClassWithLine($rectorWithLineChange);
105-
if ($rootStmt instanceof FileWithoutNamespace) {
106-
$stmts = [$this->nodeFactory->createDeclaresStrictType()];
107-
$stmts = array_merge($stmts, [new Nop()]);
108-
$stmts = array_merge($stmts, $rootStmt->stmts);
109-
$rootStmt->stmts = $stmts;
110-
return [$rootStmt];
111-
}
112-
return array_merge([$this->nodeFactory->createDeclaresStrictType(), new Nop()], $nodes);
113-
}
11469
/**
11570
* @return array<class-string<Node>>
11671
*/
11772
public function getNodeTypes(): array
11873
{
119-
return NodeGroup::STMTS_AWARE;
74+
return [FileNode::class];
12075
}
12176
/**
122-
* @param StmtsAware $node
123-
* @return null
77+
* @param FileNode $node
12478
*/
125-
public function refactor(Node $node)
79+
public function refactor(Node $node): ?FileNode
12680
{
127-
// workaround, as Rector now only hooks to specific nodes, not arrays
128-
// avoid traversing, as we already handled in beforeTraverse()
129-
return null;
81+
// when first stmt is Declare_, verify if there is strict_types definition already,
82+
// as multiple declare is allowed, with declare(strict_types=1) only allowed on very first stmt
83+
if ($this->declareStrictTypeFinder->hasDeclareStrictTypes($node)) {
84+
return null;
85+
}
86+
if (!$this->hasPHPUnitTestClass($node->stmts)) {
87+
return null;
88+
}
89+
$declareStrictTypes = $this->nodeFactory->createDeclaresStrictType();
90+
$node->stmts = array_merge([$declareStrictTypes, new Nop()], $node->stmts);
91+
return $node;
13092
}
13193
public function provideMinPhpVersion(): int
13294
{
13395
return PhpVersion::PHP_70;
13496
}
135-
/**
136-
* @param Stmt[] $nodes
137-
*/
138-
private function shouldSkipNodes(array $nodes, File $file): bool
139-
{
140-
if ($this->skipper->shouldSkipElementAndFilePath(self::class, $file->getFilePath())) {
141-
return \true;
142-
}
143-
if (strncmp($file->getFileContent(), '#!', strlen('#!')) === 0) {
144-
return \true;
145-
}
146-
return $nodes === [];
147-
}
14897
/**
14998
* @param Stmt[] $nodes
15099
*/

vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ReturnDirectJsonResponseRector.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ public function refactor(Node $node): ?Node
8989
continue;
9090
}
9191
}
92-
if ($setDataPosition === null) {
93-
if ($jsonResponseVariable instanceof Variable) {
94-
$setDataExpr = $this->matchSetDataMethodCallExpr($stmt, $jsonResponseVariable);
95-
if ($setDataExpr instanceof Expr) {
96-
$setDataPosition = $key;
97-
continue;
98-
}
92+
if ($setDataPosition === null && $jsonResponseVariable instanceof Variable) {
93+
$setDataExpr = $this->matchSetDataMethodCallExpr($stmt, $jsonResponseVariable);
94+
if ($setDataExpr instanceof Expr) {
95+
$setDataPosition = $key;
96+
continue;
9997
}
10098
}
10199
if (!$stmt instanceof Return_) {

vendor/rector/rector-symfony/rules/Symfony43/Rector/StmtsAwareInterface/TwigBundleFilesystemLoaderToTwigRector.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use PhpParser\Node\Name\FullyQualified;
1212
use PhpParser\Node\Stmt\Expression;
1313
use PHPStan\Type\ObjectType;
14-
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
1514
use Rector\PhpParser\Enum\NodeGroup;
1615
use Rector\Rector\AbstractRector;
1716
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -74,7 +73,10 @@ public function refactor(Node $node): ?Node
7473
$filesystemLoaderNew->args = [new Arg($array)];
7574
return $node;
7675
}
77-
private function resolveFileSystemLoaderNew(StmtsAwareInterface $stmtsAware): ?New_
76+
/**
77+
* @param StmtsAware $stmtsAware
78+
*/
79+
private function resolveFileSystemLoaderNew(Node $stmtsAware): ?New_
7880
{
7981
foreach ((array) $stmtsAware->stmts as $stmt) {
8082
if (!$stmt instanceof Expression) {

0 commit comments

Comments
 (0)