Skip to content

[PHP 8.1] False error: "Readonly property is assigned outside of the constructor" while in __unserialize #6384

@ruudk

Description

@ruudk

Bug report

According to the RFC assigning readonly properties should be allowed in __unserialize method.

Code snippet that reproduces the problem

https://phpstan.org/r/baac0f50-da4d-47a7-83d2-95eb8a4ea4ac

PHP 8.1 just allows this, as stated per RFC, https://3v4l.org/53Dug#v8.1.1

Expected output

No error

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

Thank you for making PHPStan better every day! It's amazing.

--

PR to solve it:

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