Skip to content

PHP 8.0 - throw statement is now throw expression, it can throw at any point #8084

@ryium

Description

@ryium

Bug report

Version

  • PHP - 8.1.10
  • PHPStan - PHP Static Analysis Tool 1.8.6
    • level 9

https://wiki.php.net/rfc/throw_expression

Code snippet that reproduces the problem

https://phpstan.org/r/e01eb1f3-1bf1-465e-85b6-f66470182d50

Expected output

If an exception is thrown, processing is interrupted, but if not, processing should be assumed to continue and the type should be correctly guessed
In this case, array_shift($params) returns string|null

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

I <3 PHPStan!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions