Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b9096b1

Browse files
Fix
1 parent 9675cc8 commit b9096b1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎src/Type/Php/FilterFunctionReturnTypeHelper.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +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()) {
195-
$type = TypeCombinator::union($type, $defaultType);
196-
}
194+
$type = TypeCombinator::union($type, $defaultType);
197195
}
198196

199197
if ($hasRequireArrayFlag->yes()) {

‎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)

AltStyle によって変換されたページ (->オリジナル) /