Updated Rector to commit 6b065efef08c34f6e3f69ebd24e24f2418f93007

6b065efef0 Bump php-parser to ^4.19.4 (#6338)
This commit is contained in:
Tomas Votruba 2024-09-29 22:47:07 +00:00
parent 2301ae1068
commit 3df699e80d
5 changed files with 24 additions and 8 deletions

View File

@ -1811,12 +1811,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49"
"reference": "9fcb7c241b4a64e133f33d5ef37021763fef7dd4"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49",
"reference": "1fdbd38d665a4a2470818fa29d8e5ef7fa76ec49",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/9fcb7c241b4a64e133f33d5ef37021763fef7dd4",
"reference": "9fcb7c241b4a64e133f33d5ef37021763fef7dd4",
"shasum": ""
},
"require": {
@ -1840,7 +1840,7 @@
"tomasvotruba\/class-leak": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2024-09-29T20:46:54+00:00",
"time": "2024-09-29T22:42:55+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
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'));
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'));
private function __construct()
{
}

View File

@ -6,6 +6,7 @@ namespace Rector\PHPUnit\CodeQuality\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Match_;
use PhpParser\Node\Expr\MethodCall;
@ -62,7 +63,7 @@ final class SomeTest extends TestCase
$matcher = $this->exactly(1);
$this->personServiceMock->expects($matcher)
->with([1], $parameters);
->with(1, $parameters);
}
}
CODE_SAMPLE
@ -106,8 +107,13 @@ CODE_SAMPLE
}
// we look for $this->assertSame(...)
$expectedExpr = $matchAndReturnMatch->getConsecutiveMatchExpr();
if ($expectedExpr instanceof Array_) {
$args = $this->nodeFactory->createArgs($expectedExpr->items);
} else {
$args = [new Arg($expectedExpr)];
}
$node->name = new Identifier('with');
$node->args = [new Arg($expectedExpr)];
$node->args = $args;
// remove the returnCallback if present
if ($matchAndReturnMatch->getWillReturnMatch() instanceof Match_) {
return new MethodCall($node, new Identifier('willReturn'), [new Arg($matchAndReturnMatch->getWillReturnMatchExpr())]);

View File

@ -107,6 +107,16 @@ CODE_SAMPLE
}
return $this->isNames($node->name, ['equalTo', 'instanceOf']);
});
// replace $this->equalsTo() with direct value
$this->traverseNodesWithCallable($firstArg->value, function (Node $node) : ?Node {
if (!$node instanceof MethodCall) {
return null;
}
if (!$this->isName($node->name, 'equalTo')) {
return null;
}
return $node->getArgs()[0]->value;
});
if ($hasAssertInside && $firstArg->value instanceof Array_) {
$args = $this->nodeFactory->createArgs($firstArg->value->items);
} else {