Skip to content

False positive: Cannot call method format() on DateTimeInterface|null. #5623

@CsabaNa

Description

@CsabaNa

Bug report

Version: 0.12.98

Call method on not null could fail after other check(s)(https://phpstan.org/r/646e73ca-76db-499f-89c9-715211db44ef). But working when the condition is closer (https://phpstan.org/r/c2d9d80b-4dcd-487a-bac8-02124d4ab25e)

Code snippet that reproduces the problem

https://phpstan.org/r/646e73ca-76db-499f-89c9-715211db44ef

Expected output

Do not show the error
like https://phpstan.org/r/c2d9d80b-4dcd-487a-bac8-02124d4ab25e

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions