From dcd58f951b1d52018f134776d45ccfd231efc78d Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 11 Sep 2025 11:00:04 +0700 Subject: [PATCH] [CodeQuality] Skip not match position named argumetn part 2 --- ...not_match_position_named_argument2.php.inc | 22 +++++++++++++++++++ ...MethodParametersAndReturnTypesResolver.php | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_not_match_position_named_argument2.php.inc diff --git a/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_not_match_position_named_argument2.php.inc b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_not_match_position_named_argument2.php.inc new file mode 100644 index 00000000..961d24c6 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_not_match_position_named_argument2.php.inc @@ -0,0 +1,22 @@ +createImage(width: 20, height: 40); + } + + public function createImage( + string $content = 'content', + int $width = 30, + int $height = 50, + int $resolution = 96 + ): void { + + } +} \ No newline at end of file diff --git a/rules/CodeQuality/Reflection/MethodParametersAndReturnTypesResolver.php b/rules/CodeQuality/Reflection/MethodParametersAndReturnTypesResolver.php index 3fc0fd1a..64c05ac5 100644 --- a/rules/CodeQuality/Reflection/MethodParametersAndReturnTypesResolver.php +++ b/rules/CodeQuality/Reflection/MethodParametersAndReturnTypesResolver.php @@ -142,6 +142,11 @@ public function resolveCallParameterNames(MethodCall|StaticCall|New_ $callLike): $callerType = $this->nodeTypeResolver->getType( $callLike instanceof MethodCall ? $callLike->var : $callLike->class ); + + if ($callerType instanceof ThisType) { + $callerType = $callerType->getStaticObjectType(); + } + if (! $callerType instanceof ObjectType) { return []; }