Skip to content

False positive "Readonly property is already assigned" in if-else #6402

@javer

Description

@javer

Bug report

After updating PHPStan from 1.3.1 to 1.4.1 assigning to a readonly property in the different branches of the same condition (if-else) is started to false trigger the error "Readonly property is already assigned".

Code snippet that reproduces the problem

https://phpstan.org/r/2069a468-0e58-4991-a125-69f1ce64f7a3

Expected output

No error should be reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions