From d2498563dd9087981fd17aac4091d6cca7cbf692 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sat, 21 Feb 2026 00:32:59 +0000 Subject: [PATCH 1/2] [automated] Update Rector Dependencies --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 368f3ca6..80fe8788 100644 --- a/composer.lock +++ b/composer.lock @@ -3514,12 +3514,12 @@ "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f38fd4a5ba583bd4300324e9ed14146c2e5f7b53" + "reference": "7257de091208898419bdaed6ebe95b3fc0b48015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f38fd4a5ba583bd4300324e9ed14146c2e5f7b53", - "reference": "f38fd4a5ba583bd4300324e9ed14146c2e5f7b53", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7257de091208898419bdaed6ebe95b3fc0b48015", + "reference": "7257de091208898419bdaed6ebe95b3fc0b48015", "shasum": "" }, "require": { @@ -3567,7 +3567,7 @@ "type": "github" } ], - "time": "2026-02-20T17:47:25+00:00" + "time": "2026-02-20T21:34:48+00:00" }, { "name": "samsonasik/array-lookup", From 9894b471cc7889fe9d6f054af5509d243b1a6627 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 21 Feb 2026 00:33:30 +0000 Subject: [PATCH 2/2] [rector] Rector fixes --- src/DemoRunner.php | 2 +- src/FileSystem/RectorFinder.php | 14 ++++++-------- src/Validation/Rules/HasRectorRule.php | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/DemoRunner.php b/src/DemoRunner.php index cfd50a3b..c3da92ed 100644 --- a/src/DemoRunner.php +++ b/src/DemoRunner.php @@ -111,7 +111,7 @@ private function processFilesContents(string $fileContent, string $rectorConfig) } catch (JsonException $jsonException) { if ($jsonException->getMessage() === 'Syntax error') { $errorMessage = 'Invalid json syntax in "vendor/bin/rector" process output: ' . PHP_EOL . PHP_EOL . $output; - throw new ShouldNotHappenException($errorMessage); + throw new ShouldNotHappenException($errorMessage, $jsonException->getCode(), $jsonException); } throw $jsonException; diff --git a/src/FileSystem/RectorFinder.php b/src/FileSystem/RectorFinder.php index 4f937ebe..e76a91bc 100644 --- a/src/FileSystem/RectorFinder.php +++ b/src/FileSystem/RectorFinder.php @@ -170,14 +170,12 @@ private function findInDirectoriesAndCreateRuleMetadatas(array $directories, arr $ruleDefinition = $rector->getRuleDefinition(); } catch (Throwable $throwable) { - throw new InvalidRuleDescriptionException( - sprintf( - 'Rule "%s" has invalid code samples:%s"%s"', - $findRectorClass, - PHP_EOL . PHP_EOL, - $throwable->getMessage() - ) - ); + throw new InvalidRuleDescriptionException(sprintf( + 'Rule "%s" has invalid code samples:%s"%s"', + $findRectorClass, + PHP_EOL . PHP_EOL, + $throwable->getMessage() + ), $throwable->getCode(), $throwable); } $ruleDefinition->setRuleClass($findRectorClass); diff --git a/src/Validation/Rules/HasRectorRule.php b/src/Validation/Rules/HasRectorRule.php index 6f069111..434dcf2f 100644 --- a/src/Validation/Rules/HasRectorRule.php +++ b/src/Validation/Rules/HasRectorRule.php @@ -75,10 +75,10 @@ private function createFromConfigs(array $configFiles): RectorConfig } catch (Throwable $e) { $message = $e->getMessage(); if (str_starts_with($message, 'Call to undefined method')) { - throw new ShouldNotHappenException('PHP config should have valid method name, you may have typo'); + throw new ShouldNotHappenException('PHP config should have valid method name, you may have typo', $e->getCode(), $e); } - throw new ShouldNotHappenException('Expected config should return callable RectorConfig instance'); + throw new ShouldNotHappenException('Expected config should return callable RectorConfig instance', $e->getCode(), $e); } }