Skip to content

is_numeric failing to refine out false #3489

@Firehed

Description

@Firehed

Bug report

Given a variable of type string|false, is_numeric fails to refine out false from the possible types, despite is_numeric(false) === false.

Code snippet that reproduces the problem

How I discovered this (roughly):
https://phpstan.org/r/85224f3b-91f7-4aa8-afa1-316466fb5bf5

Most generically:
https://phpstan.org/r/be0f3875-2615-46fb-bed9-28e400dc2d98

php > var_dump(is_numeric(false));
php shell code:1:
bool(false)

Expected output

No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions