diff --git a/src/Psalm/Diff/FileDiffer.php b/src/Psalm/Diff/FileDiffer.php index 75e1163b1..793d2ea23 100644 --- a/src/Psalm/Diff/FileDiffer.php +++ b/src/Psalm/Diff/FileDiffer.php @@ -202,8 +202,8 @@ class FileDiffer $max_same_count = min($old_text_length, $new_text_length); - for ($i = 0; $i < $max_same_count; $i++) { - if ($old_diff_text[$i] !== $new_diff_text[$i]) { + for ($j = 0; $j < $max_same_count; $j++) { + if ($old_diff_text[$j] !== $new_diff_text[$j]) { break; } @@ -213,10 +213,10 @@ class FileDiffer $new_text_length--; } - $old_diff_text = substr($old_diff_text, $i); - $new_diff_text = substr($new_diff_text, $i); + $old_diff_text = substr($old_diff_text, $j); + $new_diff_text = substr($new_diff_text, $j); - if ($last_change === null || $i) { + if ($last_change === null || $j) { $i++; $last_change = [ $a_offset, diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index 72cb0d19d..6e9394c72 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -1602,6 +1602,80 @@ class FileDiffTest extends TestCase [], [] ], + 'diffMultipleBadDocblocks' => [ + '