Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08f6dc3

Browse files
committed
speedup - skip refleciton if all params are typed
1 parent 77aeeb3 commit 08f6dc3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ private function shouldSkipClassMethod(ClassMethod $classMethod): bool
130130
return true;
131131
}
132132

133+
$isMissingParameterTypes = false;
134+
foreach ($classMethod->params as $param) {
135+
if ($param->type instanceof Node) {
136+
continue;
137+
}
138+
139+
if ($param->variadic) {
140+
continue;
141+
}
142+
143+
$isMissingParameterTypes = true;
144+
}
145+
146+
if ($isMissingParameterTypes === false) {
147+
return true;
148+
}
149+
133150
return $this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod);
134151
}
135152

0 commit comments

Comments
 (0)