Skip to content

Throw expression with null-coalesce operator does not update the type of an array #4885

@ramonacat

Description

@ramonacat

Bug report

When the $array['x'] ?? throw new \Exception() syntax is used, PHPStan should allow using the 'x' key after that expression. It does not

Code snippet that reproduces the problem

https://phpstan.org/r/62a2fe2c-78e5-41e5-982b-55ae5304d23a

Expected output

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions