Skip to content

Explicitly defined null properties are reported as (deprecated) implicitly nullable values #12501

@gsteel

Description

@gsteel

Bug report

Whilst the use-case is a bit weird perhaps, I have objects that adhere to an interface where props are string|null, however, I have an empty variant where all props are explicitly standalone null.

Regardless of the use-case, it looks like the standalone public null $someProp = null is inferred as an implicitly nullable property.

Code snippet that reproduces the problem

https://phpstan.org/r/69f2ec99-efbe-4987-8bde-beb69dbb7b70

Expected output

No issues…

Did PHPStan help you today? Did it make you happy in any way?

PHPStan makes me very happy :)

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