Skip to content

Commit aa409cb

Browse files
authored
Merge pull request #955 from PHPCSStandards/feature/reports-fix-fatal-error-code-diff-report
Report/Code: fix fatal potential fatal error when combined with Diff report
2 parents e84de7f + 81898d6 commit aa409cb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: src/Reports/Code.php

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
5555

5656
try {
5757
$phpcsFile->parse();
58+
59+
// Make sure the fixer is aware of the reparsed file to prevent a race-condition
60+
// with the Diff report also re-parsing the file.
61+
$phpcsFile->fixer->startFile($phpcsFile);
5862
} catch (Exception $e) {
5963
// This is a second parse, so ignore exceptions.
6064
// They would have been added to the file's error list already.

0 commit comments

Comments
 (0)