Skip to content

Commit

Permalink
#31176: Updated AnalysisResult constructor arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaschenko committed Feb 18, 2021
1 parent 4b92cd0 commit 841b172
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"pdepend/pdepend": "~2.7.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.8.0",
"phpstan/phpstan": "^0.12.3",
"phpstan/phpstan": "^0.12.77",
"phpunit/phpunit": "^9",
"sebastian/phpcpd": "~5.0.0",
"squizlabs/php_codesniffer": "~3.5.4"
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
class FilteredErrorFormatter implements ErrorFormatter
{
private const MUTE_ERROR_ANNOTATION = 'phpstan:ignore';

private const NO_ERRORS = 0;

/**
* @var TableErrorFormatter
*/
private $tableErrorFormatter;

/**
Expand All @@ -60,22 +62,18 @@ public function __construct(TableErrorFormatter $tableErrorFormatter)
public function formatErrors(AnalysisResult $analysisResult, Output $output): int
{
if (!$analysisResult->hasErrors()) {
$style = $output->getStyle();
$style->success('No errors');
$output->getStyle()->success('No errors');
return self::NO_ERRORS;
}

$fileSpecificErrorsWithoutIgnoredErrors = $this->clearIgnoredErrors(
$analysisResult->getFileSpecificErrors()
);

$clearedAnalysisResult = new AnalysisResult(
$fileSpecificErrorsWithoutIgnoredErrors,
$this->clearIgnoredErrors($analysisResult->getFileSpecificErrors()),
$analysisResult->getNotFileSpecificErrors(),
$analysisResult->getInternalErrors(),
$analysisResult->getWarnings(),
$analysisResult->isDefaultLevelUsed(),
$analysisResult->hasInferrablePropertyTypesFromConstructor(),
$analysisResult->getProjectConfigFile()
$analysisResult->getProjectConfigFile(),
$analysisResult->isResultCacheSaved()
);

return $this->tableErrorFormatter->formatErrors($clearedAnalysisResult, $output);
Expand Down

0 comments on commit 841b172

Please sign in to comment.