# Bug report <!-- Before reporting an issue please check that you are using the latest PHPStan version! --> <!-- Please describe your problem here. --> ### Code snippet that reproduces the problem https://phpstan.org/r/1978268f-c465-41c4-ad7f-970350cdd71e ### Expected output https://phpstan.org/r/3081cc1d-0af4-4df6-a9fe-dd23e2f23e14 I'd expect the two playgrounds to be functionally equivalent. UPDATE: interestingly enough, this https://phpstan.org/r/ee4d6b0a-455e-4801-a2ee-828307eee5f1 works as expected... I thought maybe it's because `$foo = 'bar'`; / `$foo = 'baz'`; are not opposites, but that's not the case: https://phpstan.org/r/7e3409f7-e6a3-43e8-9c41-512d2145c021. ### Did PHPStan help you today? Did it make you happy in any way? PHPStan is an invaluable tool in my development workflow. Thank you!
Activity
ondrejmirtes commentedon May 20, 2021
Hi, yeah, the "dependent types" feature can sometimes be flaky, it works in most basic scenarios only,personally I'd write this instead (that's solid): https://phpstan.org/r/b5f12e2e-9021-4936-9fcc-bcacb509efdd
Thank you for the kind words!
phpstan-bot commentedon Oct 4, 2021
@freiondrej After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
phpstan-bot commentedon Oct 4, 2021
@freiondrej After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
Updated PHPStan to commit d46211329c9a3c9cf41db0f82baf55f05ebd2cd0
Updated PHPStan to commit a4f3867d5e072d53bf19896d50d518cd0b0436c5
Fix execution branch confusion with multiple variable assignments in …
phpstan-bot commentedon Feb 27, 2026
Closed via merging phpstan/phpstan-src#5058
github-actions commentedon Mar 31, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.