Skip to content

"expects float, float|null given" error not triggered when it should #4789

@keksa

Description

@keksa

Bug report

In case method returns float|null and you check that the result is not null and then use the method again, phpstan should display an error. IIRC this was working properly in past versions.

Code snippet that reproduces the problem

https://phpstan.org/r/8b9b18a1-5a4f-4cc2-a35b-96615bd0c6eb

Expected output

Line 32 correctly triggers Parameter #1 $total of method Invoice::checkTotal() expects float, float|null given., but the same error should be triggered on lines 34 and 37.

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