-
-
Notifications
You must be signed in to change notification settings - Fork 947
Support filter_*() functions #6261
Copy link
Copy link
Closed
phpstan/phpstan-src
#2010Labels
Description
Feature request
Currently filter_input()'s resturn value is recognized to be mixed. While technically true, I would want this code to produce no errors:
<?php
declare( strict_types=1 );
function needs_int(int $x) : void {}
$x = filter_input(INPUT_POST, 'row_id', FILTER_VALIDATE_INT);
if($x === false || $x === null) {
die("I expected a numeric string!\n");
}
needs_int($x);Test code
Expected result
No errors
Current result
------ -----------------------------------------------------------------
Line test-filter_input.php
------ -----------------------------------------------------------------
17 Parameter #1 $x of function needs_int expects int, mixed given.
------ -----------------------------------------------------------------Reactions are currently unavailable