Skip to content

Commit dc7ea07

Browse files
Fix
1 parent 9675cc8 commit dc7ea07

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Type/Php/FilterFunctionReturnTypeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function getType(Type $inputType, ?Type $filterType, ?Type $flagsType): T
191191
}
192192

193193
if ($exactType === null || $hasOptions->maybe() || (!$inputType->equals($type) && $inputType->isSuperTypeOf($type)->yes())) {
194-
if ($defaultType->isSuperTypeOf($type)->no()) {
194+
if (!$defaultType->isSuperTypeOf($type)->yes()) {
195195
$type = TypeCombinator::union($type, $defaultType);
196196
}
197197
}

tests/PHPStan/Analyser/nsrt/filter-var.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ public function randomFlag($mixed, bool $bool) {
174174
assertType('int|false|null', filter_var($mixed, FILTER_VALIDATE_INT, [
175175
'flags' => $bool ? FILTER_NULL_ON_FAILURE : FILTER_FLAG_NONE,
176176
]));
177+
178+
assertType('bool|null', filter_var($mixed, FILTER_VALIDATE_BOOLEAN, [
179+
'flags' => $bool ? FILTER_NULL_ON_FAILURE : FILTER_FLAG_NONE,
180+
]));
177181
}
178182

179183
}

0 commit comments

Comments
 (0)