Skip to content

Commit 67893d4

Browse files
committed
Fix
1 parent a9851db commit 67893d4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Rules/PhpDoc/VarTagTypeRuleHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ private function checkType(Type $type, Type $varTagType): bool
171171
return $this->checkType($innerType, $innerVarTagType);
172172
}
173173

174+
if ($type->isConstantValue()->yes()) {
175+
return $type->isSuperTypeOf($varTagType)->no();
176+
}
177+
174178
return !$type->isSuperTypeOf($varTagType)->yes();
175179
}
176180

tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,6 @@ public function testEmptyArrayInitWithWiderPhpDoc(bool $checkTypeAgainstNativeTy
356356
$errors = !$checkTypeAgainstNativeType
357357
? []
358358
: [
359-
[
360-
'PHPDoc tag @var with type int|null is not subtype of native type null.',
361-
6,
362-
],
363359
[
364360
'PHPDoc tag @var with type int is not subtype of native type array{}.',
365361
24,

0 commit comments

Comments
 (0)