driftingly / rector-laravel

Rector upgrades rules for Laravel
http://getrector.org
MIT License
469 stars 48 forks source link

Adds a fix for ThrowIfRector causing issues with assigned vars #181

Closed peterfox closed 5 months ago

peterfox commented 5 months ago

Changes

Why

Sometimes the rule could generate broken code where a variable might not exist as it's created in the If statement's condition. In this instance the rule shouldn't make any changes.

if ($foo && $bar = call()) {
    throw new Exception($foo, $bar);
}