Updated Rector to commit 09a962c8cc695e8fdbeeb24e7f00f92008076ac4

09a962c8cc [Test] Add test for combination aliased + sub namespace usage on AnnotationToAttributeRector (#5289)
This commit is contained in:
Tomas Votruba 2023-11-26 07:53:02 +00:00
parent fc58b106ae
commit 0fdd1351c0
4 changed files with 24 additions and 10 deletions

View File

@ -1743,12 +1743,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "89c94de72aac045e89368088af355663b9396696"
"reference": "a08ccadb84cad9df0cbf6a03007710975e8f7232"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/89c94de72aac045e89368088af355663b9396696",
"reference": "89c94de72aac045e89368088af355663b9396696",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/a08ccadb84cad9df0cbf6a03007710975e8f7232",
"reference": "a08ccadb84cad9df0cbf6a03007710975e8f7232",
"shasum": ""
},
"require": {
@ -1775,7 +1775,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-11-07T12:17:46+00:00",
"time": "2023-11-26T07:49:39+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 9de7d58'), '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 89c94de'), '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 9d85ec1'), '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 38014d4'));
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 9de7d58'), '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 a08ccad'), '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 9d85ec1'), '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 38014d4'));
private function __construct()
{
}

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Cast\Array_;
use PhpParser\Node\Expr\FuncCall;
@ -16,8 +17,10 @@ use PhpParser\Node\Expr\NullsafeMethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Echo_;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_;
use PHPStan\Analyser\Scope;
@ -140,13 +143,12 @@ CODE_SAMPLE
$newStmts[] = new Expression(new Assign($array, $originalArray));
}
$resetFuncCall = $this->nodeFactory->createFuncCall('reset', [$array]);
$resetFuncCallExpression = new Expression($resetFuncCall);
$newStmts[] = $this->resolvePrependNewStmt($array, $resetFuncCall, $stmt);
$funcCall->name = new Name('key');
if ($originalArray !== $array) {
$firstArg = $args[0];
$firstArg->value = $array;
}
$newStmts[] = $resetFuncCallExpression;
$newStmts[] = $stmt;
return $newStmts;
}
@ -172,8 +174,7 @@ CODE_SAMPLE
$newStmts[] = new Expression(new Assign($array, $originalArray));
}
$endFuncCall = $this->nodeFactory->createFuncCall('end', [$array]);
$endFuncCallExpression = new Expression($endFuncCall);
$newStmts[] = $endFuncCallExpression;
$newStmts[] = $this->resolvePrependNewStmt($array, $endFuncCall, $stmt);
$funcCall->name = new Name('key');
if ($originalArray !== $array) {
$firstArg->value = $array;
@ -181,6 +182,19 @@ CODE_SAMPLE
$newStmts[] = $stmt;
return $newStmts;
}
/**
* @param \PhpParser\Node\Expr|\PhpParser\Node\Expr\Variable $array
* @return \PhpParser\Node\Stmt\Expression|\PhpParser\Node\Stmt\If_
*/
private function resolvePrependNewStmt($array, FuncCall $funcCall, Stmt $stmt)
{
if (!$stmt instanceof If_ || $stmt->cond instanceof FuncCall || !$stmt->cond instanceof BooleanOr) {
return new Expression($funcCall);
}
$if = new If_($this->nodeFactory->createFuncCall('is_array', [$array]));
$if->stmts[] = new Expression($funcCall);
return $if;
}
/**
* @return \PhpParser\Node\Expr|\PhpParser\Node\Expr\Variable
*/