Skip to content

Commit 8d2e5c5

Browse files
committed
usedLevel
1 parent d1240dc commit 8d2e5c5

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/Command/ErrorFormatter/TableErrorFormatter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Analyser\Error;
66
use PHPStan\Command\AnalyseCommand;
77
use PHPStan\Command\AnalysisResult;
8+
use PHPStan\Command\CommandHelper;
89
use PHPStan\Command\Output;
910
use PHPStan\DependencyInjection\AutowiredParameter;
1011
use PHPStan\DependencyInjection\AutowiredService;
@@ -44,7 +45,7 @@ public function __construct(
4445
#[AutowiredParameter]
4546
private ?string $editorUrlTitle,
4647
#[AutowiredParameter]
47-
private ?int $level,
48+
private string $usedLevel,
4849
)
4950
{
5051
}
@@ -189,7 +190,7 @@ public function formatErrors(
189190

190191
$note = [];
191192
$note[] = sprintf('Result is limited to the first %d errors', $errorsBudget);
192-
if ($this->level > 0) {
193+
if ($this->usedLevel !== CommandHelper::DEFAULT_LEVEL) {
193194
$note[] = '- Consider lowering the PHPStan level';
194195
}
195196
$note[] = sprintf('- Pass %s=1 environment variable to show all errors', self::FORCE_SHOW_ALL_ERRORS);

tests/PHPStan/Command/AnalyseApplicationIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private function runPath(string $path, int $expectedStatusCode): string
7676
false,
7777
null,
7878
null,
79-
0,
79+
CommandHelper::DEFAULT_LEVEL,
8080
);
8181
$analysisResult = $analyserApplication->analyse(
8282
[$path],

tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Override;
66
use PHPStan\Analyser\Error;
77
use PHPStan\Command\AnalysisResult;
8+
use PHPStan\Command\CommandHelper;
89
use PHPStan\File\FuzzyRelativePathHelper;
910
use PHPStan\File\NullRelativePathHelper;
1011
use PHPStan\File\SimpleRelativePathHelper;
@@ -441,7 +442,7 @@ public function testJetBrainsTerminalRelativePath(): void
441442
false,
442443
null,
443444
null,
444-
0,
445+
CommandHelper::DEFAULT_LEVEL,
445446
);
446447
$error = new Error('Test', 'Foo.php', 12, filePath: self::DIRECTORY_PATH . '/rel/Foo.php');
447448
$formatter->formatErrors(new AnalysisResult([$error], [], [], [], [], false, null, true, 0, false, []), $this->getOutput(true));
@@ -463,7 +464,7 @@ private function createErrorFormatter(?string $editorUrl, ?string $editorUrlTitl
463464
false,
464465
$editorUrl,
465466
$editorUrlTitle,
466-
0,
467+
CommandHelper::DEFAULT_LEVEL,
467468
);
468469
}
469470

0 commit comments

Comments
 (0)