Skip to content

Commit

Permalink
Rector 1.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 4, 2024
1 parent cd29621 commit 7923bd5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '2d862a7c7750c79e4c16be6e7c4e87ba324abfa7';
public const PACKAGE_VERSION = '1.2.9';
/**
* @api
* @var string
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1811,12 +1811,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "a5265a86d96a9ba7d7f9dbc20a19a3a665db70f2"
"reference": "6c454ff1341a7669f80d238eeaeab6a22cace13d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/a5265a86d96a9ba7d7f9dbc20a19a3a665db70f2",
"reference": "a5265a86d96a9ba7d7f9dbc20a19a3a665db70f2",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/6c454ff1341a7669f80d238eeaeab6a22cace13d",
"reference": "6c454ff1341a7669f80d238eeaeab6a22cace13d",
"shasum": ""
},
"require": {
Expand All @@ -1840,7 +1840,7 @@
"tomasvotruba\/class-leak": "^1.0",
"tracy\/tracy": "^2.10"
},
"time": "2024-11-04T17:53:42+00:00",
"time": "2024-11-04T18:23:18+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
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 a5265a8'), '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 799b454'));
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 6c454ff'), '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 799b454'));
private function __construct()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
Expand Down Expand Up @@ -56,15 +57,23 @@ public function refactor(Node $node)
if ($node->isFirstClassCallable()) {
return null;
}
if (\count($node->getArgs()) < 2) {
$assertArgs = $node->getArgs();
if (\count($assertArgs) < 2) {
return null;
}
$right = $node->getArgs()[1]->value;
if ($right instanceof MethodCall && $right->name instanceof Identifier && $right->name->toLowerString() === 'count' && $right->getArgs() === []) {
$type = $this->getType($right->var);
$comparedExpr = $assertArgs[1]->value;
if ($comparedExpr instanceof FuncCall && $this->isName($comparedExpr->name, 'count')) {
$countArg = $comparedExpr->getArgs()[0];
$assertArgs[1] = new Arg($countArg->value);
$node->args = $assertArgs;
$node->name = new Identifier('assertCount');
return $node;
}
if ($comparedExpr instanceof MethodCall && $this->isName($comparedExpr->name, 'count') && $comparedExpr->getArgs() === []) {
$type = $this->getType($comparedExpr->var);
if ((new ObjectType('Countable'))->isSuperTypeOf($type)->yes()) {
$args = $node->getArgs();
$args[1] = new Arg($right->var);
$args = $assertArgs;
$args[1] = new Arg($comparedExpr->var);
$node->args = $args;
$node->name = new Identifier('assertCount');
}
Expand Down

0 comments on commit 7923bd5

Please sign in to comment.