Skip to content

Commit 1d3f431

Browse files
committed
Collected PHP errors cannot be ignored
1 parent 3b6d061 commit 1d3f431

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Analyser/FileAnalyser.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use const E_NOTICE;
3232
use const E_PARSE;
3333
use const E_STRICT;
34+
use const E_USER_DEPRECATED;
3435
use const E_USER_ERROR;
3536
use const E_USER_NOTICE;
3637
use const E_USER_WARNING;
@@ -322,7 +323,7 @@ private function collectErrors(array $analysedFiles): void
322323

323324
$errorMessage = sprintf('%s: %s', $this->getErrorLabel($errno), $errstr);
324325

325-
$this->allPhpErrors[] = (new Error($errorMessage, $errfile, $errline, true))->withIdentifier('phpstan.php');
326+
$this->allPhpErrors[] = (new Error($errorMessage, $errfile, $errline, false))->withIdentifier('phpstan.php');
326327

327328
if ($errno === E_DEPRECATED) {
328329
return true;
@@ -332,7 +333,7 @@ private function collectErrors(array $analysedFiles): void
332333
return true;
333334
}
334335

335-
$this->filteredPhpErrors[] = (new Error($errorMessage, $errfile, $errline, true))->withIdentifier('phpstan.php');
336+
$this->filteredPhpErrors[] = (new Error($errorMessage, $errfile, $errline, $errno === E_USER_DEPRECATED))->withIdentifier('phpstan.php');
336337

337338
return true;
338339
});
@@ -354,12 +355,16 @@ private function getErrorLabel(int $errno): string
354355
return 'Parse error';
355356
case E_NOTICE:
356357
return 'Notice';
358+
case E_DEPRECATED:
359+
return 'Deprecated';
357360
case E_USER_ERROR:
358361
return 'User error (E_USER_ERROR)';
359362
case E_USER_WARNING:
360363
return 'User warning (E_USER_WARNING)';
361364
case E_USER_NOTICE:
362365
return 'User notice (E_USER_NOTICE)';
366+
case E_USER_DEPRECATED:
367+
return 'Deprecated (E_USER_DEPRECATED)';
363368
case E_STRICT:
364369
return 'Strict error (E_STRICT)';
365370
}

0 commit comments

Comments
 (0)