diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php index 62c49a4c526..9382cba5f0c 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php @@ -170,7 +170,8 @@ static function (Node $node) { private function shouldSkipParam(Param $param, ClassMethod $classMethod): bool { - if (! $this->paramTypeAddGuard->isLegal($param, $classMethod)) { + // already has type, skip + if ($param->type !== null) { return true; } @@ -178,7 +179,6 @@ private function shouldSkipParam(Param $param, ClassMethod $classMethod): bool return true; } - // already has type, skip - return $param->type !== null; + return ! $this->paramTypeAddGuard->isLegal($param, $classMethod); } }