Skip to content

Commit e9708a7

Browse files
committed
Updated Rector to commit 19a4c038808d4f11f5b81205dedeeb33aa8d181a
rectorphp/rector-src@19a4c03 add is in try block attribute
1 parent d9d1a25 commit e9708a7

File tree

8 files changed

+28
-24
lines changed

8 files changed

+28
-24
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 = '1b0dcb29a0fbbc8f9103a45007e822c064b84a6d';
22+
public const PACKAGE_VERSION = '19a4c038808d4f11f5b81205dedeeb33aa8d181a';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-12-08 15:17:06';
27+
public const RELEASE_DATE = '2025-12-08 16:41:14';
2828
/**
2929
* @var int
3030
*/

src/NodeTypeResolver/Node/AttributeKey.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,5 @@ final class AttributeKey
228228
public const CLASS_CONST_FETCH_NAME = 'class_const_fetch_name';
229229
public const PHP_VERSION_CONDITIONED = 'php_version_conditioned';
230230
public const HAS_CLOSURE_WITH_VARIADIC_ARGS = 'has_closure_with_variadic_args';
231+
public const IS_IN_TRY_BLOCK = 'is_in_try_block';
231232
}

src/PhpParser/NodeVisitor/ContextNodeVisitor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
use PhpParser\Node\Stmt\Function_;
3131
use PhpParser\Node\Stmt\If_;
3232
use PhpParser\Node\Stmt\Switch_;
33+
use PhpParser\Node\Stmt\TryCatch;
3334
use PhpParser\Node\Stmt\Unset_;
3435
use PhpParser\Node\Stmt\While_;
3536
use PhpParser\NodeVisitor;
3637
use PhpParser\NodeVisitorAbstract;
3738
use Rector\Contract\PhpParser\DecoratingNodeVisitorInterface;
3839
use Rector\NodeTypeResolver\Node\AttributeKey;
3940
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
41+
use Rector\PhpParser\NodeTraverser\SimpleNodeTraverser;
4042
final class ContextNodeVisitor extends NodeVisitorAbstract implements DecoratingNodeVisitorInterface
4143
{
4244
/**
@@ -63,6 +65,10 @@ public function enterNode(Node $node): ?Node
6365
}
6466
return null;
6567
}
68+
if ($node instanceof TryCatch) {
69+
SimpleNodeTraverser::decorateWithAttributeValue($node->stmts, AttributeKey::IS_IN_TRY_BLOCK, \true);
70+
return null;
71+
}
6672
if ($node instanceof Isset_) {
6773
foreach ($node->vars as $var) {
6874
$var->setAttribute(AttributeKey::IS_ISSET_VAR, \true);

vendor/composer/installed.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,12 +1877,12 @@
18771877
"source": {
18781878
"type": "git",
18791879
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
1880-
"reference": "03f4789a7327a7d1e2f069a025acce119fbde914"
1880+
"reference": "2701142a2f32b0b138365c3aa90633c01a73dea2"
18811881
},
18821882
"dist": {
18831883
"type": "zip",
1884-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/03f4789a7327a7d1e2f069a025acce119fbde914",
1885-
"reference": "03f4789a7327a7d1e2f069a025acce119fbde914",
1884+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/2701142a2f32b0b138365c3aa90633c01a73dea2",
1885+
"reference": "2701142a2f32b0b138365c3aa90633c01a73dea2",
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-06T14:55:31+00:00",
1917+
"time": "2025-12-08T15:33:46+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 5366b9a'), '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 5a4fd67'), '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 50cec58'), '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 03f4789'));
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 5366b9a'), '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 5a4fd67'), '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 50cec58'), '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 2701142'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-symfony/rules/Symfony51/Rector/ClassMethod/RouteCollectionBuilderToRoutingConfiguratorRector.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55

66
use PhpParser\Node;
77
use PhpParser\Node\Arg;
8-
use PhpParser\Node\Expr;
98
use PhpParser\Node\Expr\MethodCall;
109
use PhpParser\Node\Identifier;
1110
use PhpParser\Node\Name\FullyQualified;
1211
use PhpParser\Node\Stmt\Class_;
1312
use PhpParser\Node\Stmt\ClassMethod;
1413
use PHPStan\Type\ObjectType;
15-
use Rector\Exception\NotImplementedYetException;
16-
use Rector\NodeTypeResolver\Node\AttributeKey;
1714
use Rector\Rector\AbstractRector;
15+
use Rector\Symfony\Enum\SymfonyClass;
1816
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1917
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
2018
/**
@@ -70,7 +68,7 @@ public function getNodeTypes(): array
7068
*/
7169
public function refactor(Node $node): ?Node
7270
{
73-
if (!$this->isObjectType($node, new ObjectType('Symfony\Component\HttpKernel\Kernel'))) {
71+
if (!$this->isObjectType($node, new ObjectType(SymfonyClass::KERNEL))) {
7472
return null;
7573
}
7674
$configureRoutesClassMethod = $node->getMethod('configureRoutes');
@@ -81,10 +79,10 @@ public function refactor(Node $node): ?Node
8179
if ($firstParam->type === null) {
8280
return null;
8381
}
84-
if (!$this->isName($firstParam->type, 'Symfony\Component\Routing\RouteCollectionBuilder')) {
82+
if (!$this->isName($firstParam->type, SymfonyClass::ROUTE_COLLECTION_BUILDER)) {
8583
return null;
8684
}
87-
$firstParam->type = new FullyQualified('Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator');
85+
$firstParam->type = new FullyQualified(SymfonyClass::ROUTING_CONFIGURATOR);
8886
$configureRoutesClassMethod->name = new Identifier('configureRouting');
8987
$configureRoutesClassMethod->returnType = new Identifier('void');
9088
$this->traverseNodesWithCallable((array) $configureRoutesClassMethod->stmts, function (Node $node): ?MethodCall {
@@ -94,18 +92,14 @@ public function refactor(Node $node): ?Node
9492
if (!$this->isName($node->name, 'add')) {
9593
return null;
9694
}
97-
// avoid nesting chain iteration infinity loop
98-
$shouldSkip = (bool) $node->getAttribute(AttributeKey::DO_NOT_CHANGE);
99-
if ($shouldSkip) {
95+
// already filled
96+
$args = $node->getArgs();
97+
if (count($args) === 2) {
10098
return null;
10199
}
102-
$node->setAttribute(AttributeKey::DO_NOT_CHANGE, \true);
103-
$pathValue = $node->getArgs()[0]->value;
104-
$controllerValue = $node->getArgs()[1]->value;
105-
$nameValue = $node->getArgs()[2]->value ?? null;
106-
if (!$nameValue instanceof Expr) {
107-
throw new NotImplementedYetException();
108-
}
100+
$pathValue = $args[0]->value;
101+
$controllerValue = $args[1]->value;
102+
$nameValue = $args[2]->value;
109103
$node->args = [new Arg($nameValue), new Arg($pathValue)];
110104
return new MethodCall($node, 'controller', [new Arg($controllerValue)]);
111105
});

vendor/rector/rector-symfony/src/Enum/SymfonyClass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,7 @@ final class SymfonyClass
177177
* @var string
178178
*/
179179
public const UUID = 'Symfony\Component\Uid\Uuid';
180+
public const ROUTE_COLLECTION_BUILDER = 'Symfony\Component\Routing\RouteCollectionBuilder';
181+
public const ROUTING_CONFIGURATOR = 'Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator';
182+
public const KERNEL = 'Symfony\Component\HttpKernel\Kernel';
180183
}

0 commit comments

Comments
 (0)