Skip to content

Early termination not working for binary operators #6870

@rajyan

Description

@rajyan

Bug report

Binary operator with throw expression does not update the type of $data in the following scope.

Code snippet that reproduces the problem

https://phpstan.org/r/fb690967-90ab-4c3f-96f1-a38dbc3a97c9
It is working with Coalesce because fixed in phpstan/phpstan-src#1063, but maybe needs a more general solution.

Expected output

All dumpType should return string type

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

Yes! Of course. PHPStan is finding potentially buggy code everyday in our projects CI.
Also I can defenitely say we could not migrate our framework and upgrade our PHP version without PHPStan and Rector (which depends to PHPStan) !
https://getrector.org/blog/success-story-of-automated-framework-migration-from-fuelphp-to-laravel-of-400k-lines-application

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions