diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector/Fixture/avoid_nested_call.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector/Fixture/avoid_nested_call.php.inc new file mode 100644 index 00000000000..bfe3e7573e9 --- /dev/null +++ b/rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector/Fixture/avoid_nested_call.php.inc @@ -0,0 +1,45 @@ +someTypedService->run($value); + }; + } +} + +?> +----- +someTypedService->run($value); + }; + } +} + +?> diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php index fcc9ce4c1ee..3e19e31f613 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php @@ -111,8 +111,8 @@ public function refactor(Node $node): ?Node } /** @var array $callers */ - $callers = $this->betterNodeFinder->findInstancesOf( - $node, + $callers = $this->betterNodeFinder->findInstancesOfScoped( + [$node], [StaticCall::class, MethodCall::class, FuncCall::class] );