Skip to content

Readonly object ArrayAccess assignment detection #8929

Open
phpstan/phpstan-src
#3795
@netpok

Description

Bug report

ArrayAccess offsetSet mistakenly detected as assignment of the property itself.

Code snippet that reproduces the problem

https://phpstan.org/r/a97143d1-7447-4a63-8b43-683f17783572

Expected output

Since WeakMap implements ArrayAccess the $this->cache[$key] = $value assignement wont update the object itself but calls a method on it. I think it should not generate the warning.

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

Yes, keep up the good work.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions