Skip to content

"Unreachable statement" for function definition after exit #4002

@xPaw

Description

@xPaw

Bug report

Having an exit or return and then functions below that will trigger unreachable statement error in phpstan. In PHP however that is valid code, and you can define functions at the end of the file and call them earlier.

To clarify, without exit, phpstan is able to detect that the function exists.

Code snippet that reproduces the problem

https://phpstan.org/r/37860c0a-c071-41d7-9bf3-99cd0ac7ef27

Expected output

No error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions