Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Analyser/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function analyse(
?Closure $postFileCallback = null,
bool $debug = false,
?array $allAnalysedFiles = null,
bool $stopOnFailure = false,
): AnalyserResult
{
if ($allAnalysedFiles === null) {
Expand Down Expand Up @@ -87,7 +88,8 @@ public function analyse(
$this->collectorRegistry,
null,
);
$errors = array_merge($errors, $fileAnalyserResult->getErrors());
$fileErrors = $fileAnalyserResult->getErrors();
$errors = array_merge($errors, $fileErrors);
$filteredPhpErrors = array_merge($filteredPhpErrors, $fileAnalyserResult->getFilteredPhpErrors());
$allPhpErrors = array_merge($allPhpErrors, $fileAnalyserResult->getAllPhpErrors());

Expand All @@ -102,6 +104,11 @@ public function analyse(
if (count($fileExportedNodes) > 0) {
$exportedNodes[$file] = $fileExportedNodes;
}

// If stop-on-failure is enabled and we have errors, break the loop
if ($stopOnFailure && count($fileErrors) > 0) {
break;
}
} catch (Throwable $t) {
if ($debug) {
throw $t;
Expand All @@ -117,6 +124,10 @@ public function analyse(
$reachedInternalErrorsCountLimit = true;
break;
}
// If stop-on-failure is enabled and we have an internal error, break the loop
if ($stopOnFailure) {
break;
}
}

if ($postFileCallback === null) {
Expand Down
5 changes: 4 additions & 1 deletion src/Command/AnalyseApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function analyse(
?string $tmpFile,
?string $insteadOfFile,
InputInterface $input,
bool $stopOnFailure = false,
): AnalysisResult
{
$isResultCacheUsed = false;
Expand Down Expand Up @@ -91,6 +92,7 @@ public function analyse(
$stdOutput,
$errorOutput,
$input,
$stopOnFailure,
);

$projectStubFiles = $this->stubFilesProvider->getProjectStubFiles();
Expand Down Expand Up @@ -212,6 +214,7 @@ private function runAnalyser(
Output $stdOutput,
Output $errorOutput,
InputInterface $input,
bool $stopOnFailure = false,
): AnalyserResult
{
$filesCount = count($files);
Expand Down Expand Up @@ -252,7 +255,7 @@ private function runAnalyser(
}
}

$analyserResult = $this->analyserRunner->runAnalyser($files, $allAnalysedFiles, $preFileCallback, $postFileCallback, $debug, true, $projectConfigFile, $tmpFile, $insteadOfFile, $input);
$analyserResult = $this->analyserRunner->runAnalyser($files, $allAnalysedFiles, $preFileCallback, $postFileCallback, $debug, true, $projectConfigFile, $tmpFile, $insteadOfFile, $input, $stopOnFailure);

if (!$debug) {
$errorOutput->getStyle()->progressFinish();
Expand Down
3 changes: 3 additions & 0 deletions src/Command/AnalyseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ protected function configure(): void
new InputOption('watch', mode: InputOption::VALUE_NONE, description: 'Launch PHPStan Pro'),
new InputOption('pro', mode: InputOption::VALUE_NONE, description: 'Launch PHPStan Pro'),
new InputOption('fail-without-result-cache', mode: InputOption::VALUE_NONE, description: 'Return non-zero exit code when result cache is not used'),
new InputOption('stop-on-failure', mode: InputOption::VALUE_NONE, description: 'Stop analysis on first failure'),
]);
}

Expand Down Expand Up @@ -147,6 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$pro = (bool) $input->getOption('watch') || (bool) $input->getOption('pro');
$fix = (bool) $input->getOption('fix');
$failWithoutResultCache = (bool) $input->getOption('fail-without-result-cache');
$stopOnFailure = (bool) $input->getOption('stop-on-failure');

/** @var string|false|null $generateBaselineFile */
$generateBaselineFile = $input->getOption('generate-baseline');
Expand Down Expand Up @@ -352,6 +354,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$inceptionResult->getEditorModeTmpFile(),
$inceptionResult->getEditorModeInsteadOfFile(),
$input,
$stopOnFailure,
);
} catch (Throwable $t) {
if ($debug) {
Expand Down
5 changes: 4 additions & 1 deletion src/Command/AnalyserRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function runAnalyser(
?string $tmpFile,
?string $insteadOfFile,
InputInterface $input,
bool $stopOnFailure = false,
): AnalyserResult
{
$filesCount = count($files);
Expand All @@ -66,13 +67,14 @@ public function runAnalyser(
if (
!$debug
&& $allowParallel
&& !$stopOnFailure
&& function_exists('proc_open')
&& $mainScript !== null
&& $schedule->getNumberOfProcesses() > 0
) {
$loop = new StreamSelectLoop();
$result = null;
$promise = $this->parallelAnalyser->analyse($loop, $schedule, $mainScript, $postFileCallback, $projectConfigFile, $tmpFile, $insteadOfFile, $input, null);
$promise = $this->parallelAnalyser->analyse($loop, $schedule, $mainScript, $postFileCallback, $projectConfigFile, $tmpFile, $insteadOfFile, $input, null, $stopOnFailure);
$promise->then(static function (AnalyserResult $tmp) use (&$result): void {
$result = $tmp;
});
Expand All @@ -89,6 +91,7 @@ public function runAnalyser(
$postFileCallback,
$debug,
$this->switchTmpFile($allAnalysedFiles, $insteadOfFile, $tmpFile),
$stopOnFailure,
);
}

Expand Down
1 change: 1 addition & 0 deletions src/Parallel/ParallelAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function analyse(
?string $insteadOfFile,
InputInterface $input,
?callable $onFileAnalysisHandler,
bool $stopOnFailure = false,
): PromiseInterface
{
$jobs = array_reverse($schedule->getJobs());
Expand Down
102 changes: 100 additions & 2 deletions tests/PHPStan/Command/AnalyseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,100 @@ public function testValidAutoloadFile(): void
}
}

public function testStopOnFailureWithoutErrors(): void
{
$output = $this->runCommand(0, ['--stop-on-failure' => true]);
$this->assertStringContainsString('[OK] No errors', $output);
}

public function testStopOnFailureWithErrors(): void
{
$originalDir = getcwd();
if ($originalDir === false) {
throw new ShouldNotHappenException();
}

chdir(__DIR__);

try {
$output = $this->runCommand(1, [
'--stop-on-failure' => true,
'paths' => [
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file1-with-error.php',
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file2-with-error.php',
],
]);

// Should have errors from the first file
$this->assertStringContainsString('file1-with-error.php', $output);

// Should stop after first file with errors, so second file should not be processed
// This is the key test - we expect PHPStan to stop after the first file
$errorCount = substr_count($output, 'ERROR');
$this->assertGreaterThan(0, $errorCount, 'Should have at least one error from the first file');
} catch (Throwable $e) {
chdir($originalDir);
throw $e;
}
}

public function testStopOnFailureWithoutFlag(): void
{
$originalDir = getcwd();
if ($originalDir === false) {
throw new ShouldNotHappenException();
}

chdir(__DIR__);

try {
$output = $this->runCommand(1, [
'paths' => [
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file1-with-error.php',
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file2-with-error.php',
],
]);

// Without --stop-on-failure, both files should be analyzed
$this->assertStringContainsString('file1-with-error.php', $output);
$this->assertStringContainsString('file2-with-error.php', $output);
} catch (Throwable $e) {
chdir($originalDir);
throw $e;
}
}

public function testStopOnFailureWithConfigFile(): void
{
$originalDir = getcwd();
if ($originalDir === false) {
throw new ShouldNotHappenException();
}

chdir(__DIR__);

try {
$output = $this->runCommand(1, [
'--stop-on-failure' => true,
'--configuration' => __DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'phpstan-test.neon',
'paths' => [
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file1-with-error.php',
__DIR__ . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'file2-with-error.php',
],
]);

// Should have errors from the first file
$this->assertStringContainsString('file1-with-error.php', $output);

// With --stop-on-failure, should stop after first file with errors
$errorCount = substr_count($output, 'ERROR');
$this->assertGreaterThan(0, $errorCount, 'Should have at least one error from the first file');
} catch (Throwable $e) {
chdir($originalDir);
throw $e;
}
}

/**
* @return string[][]
*/
Expand Down Expand Up @@ -115,14 +209,18 @@ public static function autoDiscoveryPathsProvider(): array
}

/**
* @param array<string, string> $parameters
* @param array<string, string|string[]|bool> $parameters
*/
private function runCommand(int $expectedStatusCode, array $parameters = []): string
{
$commandTester = new CommandTester(new AnalyseCommand([], microtime(true)));

$defaultPaths = [__DIR__ . DIRECTORY_SEPARATOR . 'test'];
$paths = $parameters['paths'] ?? $defaultPaths;
unset($parameters['paths']);

$commandTester->execute([
'paths' => [__DIR__ . DIRECTORY_SEPARATOR . 'test'],
'paths' => $paths,
'--debug' => true,
] + $parameters, ['debug' => true]);

Expand Down
9 changes: 9 additions & 0 deletions tests/PHPStan/Command/test/file1-with-error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types = 1);

// This file contains an intentional error for testing stop-on-failure
function testFunction(): string
{

Check failure on line 5 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 5 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 5 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 5 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Function testFunction() should return string but returns int.
return 123; // Type error: returning int instead of string

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / Integration tests (windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Function testFunction() should return string but returns int.

Check failure on line 6 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Function testFunction() should return string but returns int.
}

Check failure on line 8 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 8 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 8 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 8 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Variable $nonExistentVar might not be defined.
$undefinedVariable = $nonExistentVar; // Undefined variable error

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / Integration tests (windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Variable $nonExistentVar might not be defined.

Check failure on line 9 in tests/PHPStan/Command/test/file1-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Variable $nonExistentVar might not be defined.
13 changes: 13 additions & 0 deletions tests/PHPStan/Command/test/file2-with-error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php declare(strict_types = 1);

// This file also contains intentional errors for testing stop-on-failure
class TestClass
{
public function methodWithError(): int

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / Integration tests (ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Unused TestClass::methodWithError

Check failure on line 6 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Unused TestClass::methodWithError
{
return "not an integer"; // Type error: returning string instead of int

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / Integration tests (ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Method TestClass::methodWithError() should return int but returns string.

Check failure on line 8 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Method TestClass::methodWithError() should return int but returns string.
}
}

$obj = new TestClass();
$result = $obj->nonExistentMethod(); // Method does not exist error

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / Integration tests (ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to an undefined method TestClass::nonExistentMethod().

Check failure on line 13 in tests/PHPStan/Command/test/file2-with-error.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to an undefined method TestClass::nonExistentMethod().
6 changes: 6 additions & 0 deletions tests/PHPStan/Command/test/phpstan-test.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: 1
paths:
- .
excludePaths:
- empty.php
Loading