Skip to content

Commit

Permalink
Fix PHPStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Bellangelo committed Jul 9, 2024
1 parent 11205a6 commit e2c2eb3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 38 deletions.
8 changes: 4 additions & 4 deletions src/Extensions/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ protected function incrementSuitesCounter(): void

protected function suiteStarted(TestSuite $testSuite): void
{
if (!$this->shouldRunTimeReport() || !class_exists($testSuite->getName())) {
if (!$this->shouldRunTimeReport() || !class_exists($testSuite->name())) {
return;
}

$this->incrementSuitesCounter();

$file = $this->extractFilenameFromClass($testSuite->getName());
$file = $this->extractFilenameFromClass($testSuite->name());

$this->storeStartTime(StorageHandler::getRelativePathBasedOnTests($file));
}

protected function suiteEnded(TestSuite $testSuite): void
{
if (!$this->shouldRunTimeReport() || !class_exists($testSuite->getName())) {
if (!$this->shouldRunTimeReport() || !class_exists($testSuite->name())) {
return;
}

$file = $this->extractFilenameFromClass($testSuite->getName());
$file = $this->extractFilenameFromClass($testSuite->name());

$this->storeEndTime(
StorageHandler::getRelativePathBasedOnTests($file),
Expand Down
24 changes: 0 additions & 24 deletions src/Extensions/ExtensionV9.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/PHPUnit/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public static function getPHPUnitConfigurationDirectory(): ?string
global $argv;

$configKey = array_search('--configuration', $argv, true);
if ($configKey !== false && isset($argv[$configKey + 1])) {
$configurationFile = realpath($argv[$configKey + 1]);
if ($configKey !== false && isset($argv[(int) $configKey + 1])) {
$configurationFile = realpath($argv[(int) $configKey + 1]);

if (!$configurationFile) {
return null;
Expand Down
7 changes: 1 addition & 6 deletions src/PHPUnit/NewFilesTestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Bellangelo\TestSuiteArchitect\ValueObjects\TestTimerCollection;
use Exception;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Util\FileLoader;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RuntimeException;
Expand All @@ -30,14 +29,10 @@ protected static function addNewTestsForCurrentPartition(
if (isset($partitions[$index])) {
foreach ($partitions[$index] as $test) {
try {
FileLoader::checkAndLoad($test->getName());
$testSuite->addTestFile($test->getName());
} catch (Exception $e) {
// This can happen if a given class is not a test suite.
// TODO: Handle better such errors.
continue;
}

$testSuite->addTestFile($test->getName());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/StorageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ private static function getRelativePath(string $from, string $to): string
$to = rtrim(str_replace('\\', '/', $to), '/');

// Create arrays from paths and filter out empty values
$fromParts = array_filter(explode('/', $from), 'strlen');
$toParts = array_filter(explode('/', $to), 'strlen');
$fromParts = array_filter(explode('/', $from), null);
$toParts = array_filter(explode('/', $to), null);

// Count of same path parts
$samePartsCount = 0;
Expand Down

0 comments on commit e2c2eb3

Please sign in to comment.