Skip to content

Commit

Permalink
Do not complain about unmatched ignored errors when internal errors o…
Browse files Browse the repository at this point in the history
…ccur
  • Loading branch information
ondrejmirtes committed Mar 15, 2020
1 parent 3193ae9 commit ecef44f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Analyser/IgnoredErrorHelperResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getWarnings(): array
* @param Error[] $errors
* @return string[]|Error[]
*/
public function process(array $errors, bool $onlyFiles, bool $reachedInternalErrorsCountLimit): array
public function process(array $errors, bool $onlyFiles, bool $hasInternalErrors): array
{
$unmatchedIgnoredErrors = $this->ignoreErrors;
$addErrors = [];
Expand Down Expand Up @@ -206,7 +206,7 @@ public function process(array $errors, bool $onlyFiles, bool $reachedInternalErr

$errors = array_merge($errors, $addErrors);

if ($this->reportUnmatchedIgnoredErrors && !$reachedInternalErrorsCountLimit) {
if ($this->reportUnmatchedIgnoredErrors && !$hasInternalErrors) {
foreach ($unmatchedIgnoredErrors as $unmatchedIgnoredError) {
if (
isset($unmatchedIgnoredError['count'])
Expand Down
5 changes: 3 additions & 2 deletions src/Command/AnalyseApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ public function analyse(
);
$analyserResult = $this->resultCacheManager->process($intermediateAnalyserResult, $resultCache);
$hasInferrablePropertyTypesFromConstructor = $analyserResult->hasInferrablePropertyTypesFromConstructor();
$errors = $ignoredErrorHelperResult->process($analyserResult->getErrors(), $onlyFiles, $analyserResult->hasReachedInternalErrorsCountLimit());
$internalErrors = $analyserResult->getInternalErrors();
$errors = $ignoredErrorHelperResult->process($analyserResult->getErrors(), $onlyFiles, count($internalErrors) > 0 || $analyserResult->hasReachedInternalErrorsCountLimit());
$warnings = $ignoredErrorHelperResult->getWarnings();
if ($analyserResult->hasReachedInternalErrorsCountLimit()) {
$errors[] = sprintf('Reached internal errors count limit of %d, exiting...', $this->internalErrorsCountLimit);
}
$errors = array_merge($errors, $analyserResult->getInternalErrors());
$errors = array_merge($errors, $internalErrors);
}

$errors = array_merge($stubErrors, $errors);
Expand Down

0 comments on commit ecef44f

Please sign in to comment.