🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Since 2.2.2: implication learned from an && guard drops one of its conditions and chains into a wrong type #14780

Description

@janedbal

Bug report

When two early-return/throw guards interact, PHPStan learns a conditional implication from the second guard's negated branch but drops one of the conjuncts, then chains it with a fact from the first guard. The result is a type that is narrower than reality — a reachable value is dropped.

Code snippet that reproduces the problem

https://phpstan.org/r/45b5a0db-a0a7-4df7-a2bd-2438fe30072d

Expected output

Dumped type: int|null

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