Skip to content

Wrong "dead catch" error, side effects of ArrayAccess not considered #11427

@thg2k

Description

@thg2k

Bug report

The implementation of ArrayAccess can throw exceptions, causing statements like unset($x[1]); actually throw.

Of the examples in the sample link, only $x[1] = ... correctly assumes an exception might be thrown (i.e. offsetSet), while offsetGet/offsetExists/offsetUnset are not considered.

https://3v4l.org/J4RXD

Code snippet that reproduces the problem

https://phpstan.org/r/6d994e87-1f2d-4473-921c-7acd9b810661

Expected output

No errors

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions