From a4b9deeec52cb95136217b65239e3ec5036ae484 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 15 Nov 2024 13:26:50 +0100 Subject: [PATCH] [automated] Update Rector Dependencies (#2676) * [automated] Update Rector Dependencies * fix --------- Co-authored-by: TomasVotruba Co-authored-by: Abdul Malik Ikhsan --- composer.lock | 8 ++++---- phpstan.neon | 4 ++++ src/FileSystem/RectorFinder.php | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index c69159e26..3d262432b 100644 --- a/composer.lock +++ b/composer.lock @@ -3268,12 +3268,12 @@ "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "c4fafc51d3da163106248f2fa63152e712c46bf6" + "reference": "4173b9e2157f32f87bf268ecdca5f8a7d524361c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/c4fafc51d3da163106248f2fa63152e712c46bf6", - "reference": "c4fafc51d3da163106248f2fa63152e712c46bf6", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/4173b9e2157f32f87bf268ecdca5f8a7d524361c", + "reference": "4173b9e2157f32f87bf268ecdca5f8a7d524361c", "shasum": "" }, "require": { @@ -3320,7 +3320,7 @@ "type": "github" } ], - "time": "2024-11-14T18:10:50+00:00" + "time": "2024-11-15T10:55:38+00:00" }, { "name": "samsonasik/array-lookup", diff --git a/phpstan.neon b/phpstan.neon index 6ba1583ae..9563532ae 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -74,3 +74,7 @@ parameters: - message: '#Cannot call method format\(\) on Carbon\\Carbon\|null#' path: src/Controller/Stats/FindRuleStatsController.php + + - + message: '#Call to an undefined method Rector\\Contract\\Rector\\RectorInterface\:\:getRuleDefinition\(\)#' + path: src/FileSystem/RectorFinder.php diff --git a/src/FileSystem/RectorFinder.php b/src/FileSystem/RectorFinder.php index 42dd2dd26..e59357313 100644 --- a/src/FileSystem/RectorFinder.php +++ b/src/FileSystem/RectorFinder.php @@ -141,6 +141,11 @@ private function findInDirectoriesAndCreateRuleMetadatas(array $directories, arr $rector = $rectorReflectionClass->newInstanceWithoutConstructor(); + // only list rules with rule definition + if (! method_exists($rector, 'getRuleDefinition')) { + continue; + } + /** @var RectorInterface $rector */ $ruleDefinition = $rector->getRuleDefinition(); $ruleDefinition->setRuleClass($rectorClass);