diff --git a/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_without_construct.php.inc b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_without_construct.php.inc new file mode 100644 index 00000000..c5e56375 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Fixture/skip_without_construct.php.inc @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Source/ValueObjectWithoutConstructor.php b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Source/ValueObjectWithoutConstructor.php new file mode 100644 index 00000000..fd69eb9d --- /dev/null +++ b/rules-tests/CodeQuality/Rector/MethodCall/ScalarArgumentToExpectedParamTypeRector/Source/ValueObjectWithoutConstructor.php @@ -0,0 +1,9 @@ +reflectionProvider->getClass($className); + + if (! $classReflection->hasConstructor()) { + return null; + } + return $this->resolveParameterTypes($classReflection->getConstructor(), $classReflection); } @@ -130,6 +135,11 @@ public function resolveCallParameterNames(MethodCall|StaticCall|New_ $callLike): } $classReflection = $this->reflectionProvider->getClass($className); + + if (! $classReflection->hasConstructor()) { + return []; + } + return $this->resolveParameterNames($classReflection->getConstructor()); }