|
23 | 23 | use PHPStan\Fixable\FileChangedException; |
24 | 24 | use PHPStan\Fixable\MergeConflictException; |
25 | 25 | use PHPStan\Fixable\Patcher; |
| 26 | +use PHPStan\Internal\AgentDetector; |
26 | 27 | use PHPStan\Internal\BytesHelper; |
27 | 28 | use PHPStan\Internal\DirectoryCreator; |
28 | 29 | use PHPStan\Internal\DirectoryCreatorException; |
@@ -578,6 +579,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
578 | 579 | $exitCode = 0; |
579 | 580 | } |
580 | 581 | } else { |
| 582 | + if (AgentDetector::isRunningInAgent() && count($analysisResult->getFileSpecificErrors()) > 0) { |
| 583 | + $errorOutput->writeLineFormatted('Instructions for interpreting errors'); |
| 584 | + $errorOutput->writeLineFormatted('---------'); |
| 585 | + $errorOutput->writeLineFormatted(''); |
| 586 | + $errorOutput->writeLineFormatted('Each error has an associated identifier, like `argument.type`'); |
| 587 | + $errorOutput->writeLineFormatted('or `return.missing`.'); |
| 588 | + $errorOutput->writeLineFormatted(''); |
| 589 | + $errorOutput->writeLineFormatted('Each error identifier has documentation at URL https://phpstan.org/error-identifiers/<identifier>.'); |
| 590 | + $errorOutput->writeLineFormatted('This page contains code example, explanation why is this an error'); |
| 591 | + $errorOutput->writeLineFormatted('and instruction how to fix it.'); |
| 592 | + $errorOutput->writeLineFormatted('Before fixing the error, fetch the documentation page for its identifier.'); |
| 593 | + $errorOutput->writeLineFormatted(''); |
| 594 | + $errorOutput->writeLineFormatted('The error usually indicates a real bug or incorrect type in the code. Fix the underlying cause, do not just make the error go away.'); |
| 595 | + $errorOutput->writeLineFormatted('Do not add `@phpstan-ignore` comments, `@phpstan-ignore-next-line` comments, or baseline entries to suppress the error.'); |
| 596 | + $errorOutput->writeLineFormatted('Do not use assert() or inline @var PHPDoc tag to override PHPStan\'s inferred type.'); |
| 597 | + $errorOutput->writeLineFormatted('Do not add type casts just to silence errors.'); |
| 598 | + $errorOutput->writeLineFormatted('Do not widen parameter or return types just to make the error go away.'); |
| 599 | + } |
581 | 600 | $exitCode = $errorFormatter->formatErrors($analysisResult, $inceptionResult->getStdOutput()); |
582 | 601 | } |
583 | 602 |
|
|
0 commit comments