Skip to content

Nullable parameter is not infered to not nullable after conditions checking for null #4215

@MK-42

Description

@MK-42

Bug report

Conditions that ensure nullable int is not nullable anymore are not respected by phpstan.
The two conditions cancel out the possibility that the nullable int parameter is null.

Code snippet that reproduces the problem

https://phpstan.org/r/b4d84b76-413d-4cab-961a-ba20da3497fd

Expected output

There should be no error detected in the code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions