Thanks to visit codestin.com
Credit goes to github.com

Skip to content

False positive Unreachable statement #14582

@simPod

Description

@simPod

Bug report

getChoice($right)->proceed(
	right: noop(...),
	left: fn (string $message) => throw new RuntimeException($message),
);

phpstan for some reason thinks the throw is the only path here and marks all code bellow as unreachable

Code snippet that reproduces the problem

https://phpstan.org/r/ce22c691-e5a5-4295-ab70-84643e71ab76

Expected output

No Unreachable statement - code above always terminates. violation

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions