Fix filter var on uncertainty flags - #4418
Conversation
| } | ||
|
|
||
| $type = $this->getFlagsValue($flagsType); | ||
| if (!$type instanceof ConstantIntegerType) { |
There was a problem hiding this comment.
In next PR I'll add support for union of ConstantIntegerType
| ['%s|false', ''], | ||
| ['%s|false', ', $mixed'], | ||
| ['%s|false', ', ["flags" => $mixed]'], | ||
| ['mixed', ', $mixed'], |
There was a problem hiding this comment.
This was wrong, with a mixed flag it's not necessary %s|false cause you might pass FILTER_NULL_ON_FAILURE or FILTER_FORCE_ARRAY or FILTER_REQUIRE_ARRAY
| ['%s|false', ', $mixed'], | ||
| ['%s|false', ', ["flags" => $mixed]'], | ||
| ['mixed', ', $mixed'], | ||
| ['mixed', ', ["flags" => $mixed]'], |
There was a problem hiding this comment.
This was wrong, with a mixed flag it's not necessary %s|false cause you might pass FILTER_NULL_ON_FAILURE or FILTER_FORCE_ARRAY or FILTER_REQUIRE_ARRAY
| ['mixed', ', $mixed'], | ||
| ['mixed', ', ["flags" => $mixed]'], |
There was a problem hiding this comment.
This was wrong, with a mixed flag it's not necessary bool cause you might pass FILTER_NULL_ON_FAILURE or FILTER_FORCE_ARRAY or FILTER_REQUIRE_ARRAY
| { | ||
| assertType('int', filter_var($int, FILTER_VALIDATE_INT)); | ||
| assertType('int|false', filter_var($int, FILTER_VALIDATE_INT, $options)); | ||
| assertType('mixed', filter_var($int, FILTER_VALIDATE_INT, $options)); |
There was a problem hiding this comment.
This was wrong, with a array $options, the flag might be mixed.
And with a mixed flag it's not necessary mixed cause you might pass FILTER_NULL_ON_FAILURE or FILTER_FORCE_ARRAY or FILTER_REQUIRE_ARRAY
|
This pull request has been marked as ready for review. |
48abefc to
32e8d95
Compare
|
Thank you! |
Closes phpstan/phpstan#11485