From ab06c87a77ac4768c2749ba0e50c9513b7dd3313 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 8 Sep 2026 21:27:27 +0200 Subject: [PATCH] [Symfony44] Require \Throwable catch in ConsoleExecuteReturnIntRector try/catch fixtures --- .../Fixture/skip_try_catch_return.php.inc | 2 +- .../skip_try_catch_return_with_stmts_before_return.php.inc | 2 +- .../Fixture/try_catch_return_with_stmts_before_return.php.inc | 4 ++-- .../MethodCall/WebLinkStringRelationsToConstantsRector.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return.php.inc b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return.php.inc index d9b6c5614..b93aa7d21 100644 --- a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return.php.inc +++ b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return.php.inc @@ -12,7 +12,7 @@ final class SkipTryCatchReturn extends Command { try { return 0; - } catch (\Exception $e) { + } catch (\Throwable $e) { return 1; } } diff --git a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return_with_stmts_before_return.php.inc b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return_with_stmts_before_return.php.inc index 882a9faf8..36bc4cf2b 100644 --- a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return_with_stmts_before_return.php.inc +++ b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/skip_try_catch_return_with_stmts_before_return.php.inc @@ -13,7 +13,7 @@ final class SkipTryCatchReturnWithStmtsBeforeReturn extends Command try { $output->writeln('working'); return 0; - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $output->writeln($exception->getMessage()); return 1; } diff --git a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/try_catch_return_with_stmts_before_return.php.inc b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/try_catch_return_with_stmts_before_return.php.inc index 2249a195a..411f9d29f 100644 --- a/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/try_catch_return_with_stmts_before_return.php.inc +++ b/rules-tests/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector/Fixture/try_catch_return_with_stmts_before_return.php.inc @@ -13,7 +13,7 @@ final class TryCatchReturnWithStmtsBeforeReturnCommand extends Command try { $output->writeln('working'); return 0; - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $output->writeln($exception->getMessage()); return 1; } @@ -37,7 +37,7 @@ final class TryCatchReturnWithStmtsBeforeReturnCommand extends Command try { $output->writeln('working'); return 0; - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $output->writeln($exception->getMessage()); return 1; } diff --git a/rules/Symfony44/Rector/MethodCall/WebLinkStringRelationsToConstantsRector.php b/rules/Symfony44/Rector/MethodCall/WebLinkStringRelationsToConstantsRector.php index f6798bdf0..988ab7b26 100644 --- a/rules/Symfony44/Rector/MethodCall/WebLinkStringRelationsToConstantsRector.php +++ b/rules/Symfony44/Rector/MethodCall/WebLinkStringRelationsToConstantsRector.php @@ -94,7 +94,7 @@ public function refactor(Node $node): ?Node } $constFetch = $this->createConstantFetch($valueNode->value); - if (! $constFetch) { + if (!$constFetch instanceof Node) { return null; }