Skip to content

Commit 3df699e

Browse files
committed
Updated Rector to commit 6b065efef08c34f6e3f69ebd24e24f2418f93007
rectorphp/rector-src@6b065ef Bump php-parser to ^4.19.4 (#6338)
1 parent 2301ae1 commit 3df699e

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

vendor/composer/installed.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,12 +1811,12 @@
18111811
"source": {
18121812
"type": "git",
18131813
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
1814-
"reference": "1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49"
1814+
"reference": "9fcb7c241b4a64e133f33d5ef37021763fef7dd4"
18151815
},
18161816
"dist": {
18171817
"type": "zip",
1818-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49",
1819-
"reference": "1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49",
1818+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/9fcb7c241b4a64e133f33d5ef37021763fef7dd4",
1819+
"reference": "9fcb7c241b4a64e133f33d5ef37021763fef7dd4",
18201820
"shasum": ""
18211821
},
18221822
"require": {
@@ -1840,7 +1840,7 @@
18401840
"tomasvotruba\/class-leak": "^0.2",
18411841
"tracy\/tracy": "^2.10"
18421842
},
1843-
"time": "2024-09-29T20:46:54+00:00",
1843+
"time": "2024-09-29T22:42:55+00:00",
18441844
"default-branch": true,
18451845
"type": "rector-extension",
18461846
"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 e75008c'), '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 d9cef57'), '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 1fdbd38'), '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 14fcc87'));
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 e75008c'), '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 d9cef57'), '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 9fcb7c2'), '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 14fcc87'));
1313
private function __construct()
1414
{
1515
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PhpParser\Node;
77
use PhpParser\Node\Arg;
88
use PhpParser\Node\Expr;
9+
use PhpParser\Node\Expr\Array_;
910
use PhpParser\Node\Expr\Closure;
1011
use PhpParser\Node\Expr\Match_;
1112
use PhpParser\Node\Expr\MethodCall;
@@ -62,7 +63,7 @@ public function run()
6263
$matcher = $this->exactly(1);
6364
6465
$this->personServiceMock->expects($matcher)
65-
->with([1], $parameters);
66+
->with(1, $parameters);
6667
}
6768
}
6869
CODE_SAMPLE
@@ -106,8 +107,13 @@ public function refactor(Node $node) : ?\PhpParser\Node\Expr\MethodCall
106107
}
107108
// we look for $this->assertSame(...)
108109
$expectedExpr = $matchAndReturnMatch->getConsecutiveMatchExpr();
110+
if ($expectedExpr instanceof Array_) {
111+
$args = $this->nodeFactory->createArgs($expectedExpr->items);
112+
} else {
113+
$args = [new Arg($expectedExpr)];
114+
}
109115
$node->name = new Identifier('with');
110-
$node->args = [new Arg($expectedExpr)];
116+
$node->args = $args;
111117
// remove the returnCallback if present
112118
if ($matchAndReturnMatch->getWillReturnMatch() instanceof Match_) {
113119
return new MethodCall($node, new Identifier('willReturn'), [new Arg($matchAndReturnMatch->getWillReturnMatchExpr())]);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ public function refactor(Node $node) : ?\PhpParser\Node\Expr\MethodCall
107107
}
108108
return $this->isNames($node->name, ['equalTo', 'instanceOf']);
109109
});
110+
// replace $this->equalsTo() with direct value
111+
$this->traverseNodesWithCallable($firstArg->value, function (Node $node) : ?Node {
112+
if (!$node instanceof MethodCall) {
113+
return null;
114+
}
115+
if (!$this->isName($node->name, 'equalTo')) {
116+
return null;
117+
}
118+
return $node->getArgs()[0]->value;
119+
});
110120
if ($hasAssertInside && $firstArg->value instanceof Array_) {
111121
$args = $this->nodeFactory->createArgs($firstArg->value->items);
112122
} else {

0 commit comments

Comments
 (0)