Skip to content

Commit

Permalink
Raised PHPStan to level 5
Browse files Browse the repository at this point in the history
  • Loading branch information
DonCallisto committed Oct 7, 2020
1 parent d3d8514 commit f844c76
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
7 changes: 5 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ includes:
- vendor/phpstan/phpstan-phpunit/extension.neon

parameters:
level: 3
level: 5
paths:
- src
- tests
- tests
reportUnmatchedIgnoredErrors: false
ignoreErrors: #see https://github.com/phpstan/phpstan/issues/1267#issuecomment-552874947 -> @todo remove when sf 3.4 support ends
- "#^Call to an undefined static method #"
1 change: 1 addition & 0 deletions src/Process/ProcessorCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private function readFromProcCPUInfo()
$process = Process::fromShellCommandline($executeCommand);
} else {
// Drop when sf 3.4 supports ends
/** @phpstan-ignore-next-line */ // @todo remove when sf 3.4 support ends
$process = new Process($executeCommand);
}
$process->run();
Expand Down
4 changes: 2 additions & 2 deletions src/Process/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Report
/**
* @param string $suite
* @param bool $isSuccess
* @param int $time
* @param float $time
* @param int $processorNumber
* @param string|null $errorBuffer
* @param bool $isFirstOnThread
Expand Down Expand Up @@ -68,7 +68,7 @@ public function getSuite()
}

/**
* @return int Time in microseconds
* @return float Time in microseconds
*/
public function getTime()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Queue/CreateTestsQueueFromPhpUnitXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function execute($xmlFile)

private static function processTestSuite(
TestsQueue $testSuites,
\PHPUnit\Framework\TestSuiteIterator $testSuiteIterator
\Iterator $testSuiteIterator
) {
foreach ($testSuiteIterator as $testSuite) {
self::addTestFile($testSuites, $testSuite);
Expand Down
4 changes: 2 additions & 2 deletions src/UI/VerboseRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function renderBody(QueueInterface $queue, Processes $processes)

$log = $processes->getReport();
$count = count($log);
$tests = array_slice($log, $this->lastIndex, $count, 1);
$tests = array_slice($log, $this->lastIndex, $count, true);

foreach ($tests as $report) {
++$this->lastIndex;
Expand Down Expand Up @@ -90,7 +90,7 @@ public function renderBody(QueueInterface $queue, Processes $processes)
/**
* Method to format duration to human readable format.
*
* @param int $milliseconds
* @param float $milliseconds
*
* @return string
*/
Expand Down
6 changes: 3 additions & 3 deletions tests/Process/ProcessesManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function shouldCreateBeforeProcessesExecutingFactoryWithTheCorrectArgumen
$this->assertTrue($manager->assertNProcessRunning($queue, $processes));
}

/**
/**src/UI/VerboseRenderer.php
* @test
*/
public function shouldCreateProcessesWithoutBeforeProcessExecutingFactoryWithTheCorrectArguments()
Expand All @@ -57,7 +57,7 @@ public function shouldCreateProcessesWithoutBeforeProcessExecutingFactoryWithThe
$factory->expects($this->exactly(1))
->method('createAProcess')
->with($this->anything(), $this->equalTo(1), $this->equalTo(1), $this->equalTo(true))
->willReturn(new Process(['echo '], rand()));
->willReturn(new Process(['echo '], (string) rand()));

$manager = new ProcessesManager($factory, 1);

Expand Down Expand Up @@ -107,7 +107,7 @@ public function shouldCreate6ProcessesGivingThemTheCorrectEnvParameters()
$factory->expects($this->at($at))
->method('createAProcess')
->with($this->anything(), $this->equalTo($expectation[0]), $this->equalTo($expectation[1]), $this->equalTo($expectation[2]))
->willReturn(new Process(['echo '], rand()));
->willReturn(new Process(['echo '], (string) rand()));
}

$manager = new ProcessesManager($factory, 1);
Expand Down

0 comments on commit f844c76

Please sign in to comment.