Skip to content

Commit fb4c5ba

Browse files
committed
Try to avoid infinite recursion
1 parent 4b1895d commit fb4c5ba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Rules/PhpDoc/VarTagTypeRuleHelper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ private function checkType(Type $type, Type $varTagType): bool
117117
return true;
118118
}
119119

120-
return $this->checkType($type->getIterableValueType(), $varTagType->getIterableValueType());
120+
$innerType = $type->getIterableValueType();
121+
$innerVarTagType = $varTagType->getIterableValueType();
122+
123+
if ($type->equals($innerType) || $varTagType->equals($innerVarTagType)) {
124+
return !$innerType->isSuperTypeOf($innerVarTagType)->yes();
125+
}
126+
127+
return $this->checkType($innerType, $innerVarTagType);
121128
}
122129

123130
return !$type->isSuperTypeOf($varTagType)->yes();

0 commit comments

Comments
 (0)