Skip to content

Useless null coalesce not reported when relying on class property typehint #4846

@janedbal

Description

@janedbal

Bug report

Condition always-string ?? 'string' is not reported as useless in following snippet. When passed as argument, it works.

Code snippet that reproduces the problem

Snippet: https://phpstan.org/r/9aa7f36f-d294-404f-849b-590a288ad9fe

Expected output

Useless null coalesce reported

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions