Skip to content

False positive with int|string and is_numeric() (0.12.15) #3094

@Majkl578

Description

@Majkl578

Bug report

PHPStan 0.12.15 incorrectly recognizes is_numeric() with non-constant int|string as always-true expression.

Code snippet that reproduces the problem

https://phpstan.org/r/34aaa80e-0c2c-4773-a38d-b9bf6b219017

This seems to only be reported when strict rules are enabled, however it started happening after update from 0.12.14 to 0.12.15 with phpstan-strict-rules being unchanged (0.12.2) so I assume this is an issue in PHPStan core.

Expected output

No error reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions