Skip to content

Commit

Permalink
Remove PHPStan's baseline for src (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Oct 13, 2021
1 parent d86ddd6 commit ef4ddca
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 224 deletions.
217 changes: 0 additions & 217 deletions devTools/phpstan-src-baseline.neon

This file was deleted.

10 changes: 9 additions & 1 deletion devTools/phpstan-src.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
includes:
- ../vendor/phpstan/phpstan/conf/bleedingEdge.neon
- phpstan-src-baseline.neon

parameters:
tmpDir: ../build/cache/phpstan-src
inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
- '#.* value type specified in iterable type Symfony\\Component\\Process\\Process#'
- '#generic class ReflectionClass (but )?does not specify its types#'
- '#^Call to static method Webmozart\\Assert\\[a-zA-Z]+::[a-zA-Z]+\(\) with .* will always evaluate to true\.$#'
- '#^Parameter \#\d+ \$.+ \(.+\) of method .+ should be contravariant with parameter \$.+ \(.+\) of method .+$#'
- '#^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.$#'
- '#^Variable (method|property) (access|call) #'
-
path: '../src/Mutator/Number/DecrementInteger.php'
message: '#Casting to int .* already int#'
Expand All @@ -28,6 +31,10 @@ parameters:
path: '../src/TestFramework/Coverage/XmlReport/SourceFileInfoProvider.php'
message: '#Function realpath is unsafe to use\.#'
count: 1
-
path: ../src/TestFramework/Factory.php
message: "#^Parameter \\#1 \\$it of function iterator_to_array expects Traversable, iterable\\<Infection\\\\TestFramework\\\\Coverage\\\\Trace\\|SplFileInfo\\> given\\.$#"
count: 1
-
path: '../src/Container.php'
message: '#^Method Infection\\Container::get.*\(\) should return .* but returns object\.$#'
Expand All @@ -38,3 +45,4 @@ parameters:
level: max
paths:
- ../src
treatPhpDocTypesAsCertain: false
6 changes: 3 additions & 3 deletions src/Logger/PerMutatorLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static function calculateColumnSizes(array $table): array

foreach ($table as $row) {
foreach ($row as $columnNumber => $cell) {
$sizes[$columnNumber] = (int) max($sizes[$columnNumber], strlen($cell));
$sizes[$columnNumber] = max($sizes[$columnNumber], strlen($cell));
}
}

Expand Down Expand Up @@ -179,11 +179,11 @@ private static function createSeparatorRow(array $columnSizes): string
*/
private function createMetricsPerMutators(): array
{
$executionResults = $this->resultsCollector->getAllExecutionResults();
$allExecutionResults = $this->resultsCollector->getAllExecutionResults();

$processPerMutator = [];

foreach ($executionResults as $executionResult) {
foreach ($allExecutionResults as $executionResult) {
$mutatorName = $executionResult->getMutatorName();
$processPerMutator[$mutatorName][] = $executionResult;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Logger/TextFileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function getLogLines(): array
{
$separateSections = false;

$logs = [];

$logs[] = $this->getResultsLine(
$this->resultsCollector->getEscapedExecutionResults(),
'Escaped',
Expand Down
2 changes: 1 addition & 1 deletion src/Mutator/MutatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function getMutatorNameForClassName(string $className): string
{
$parts = explode('\\', $className);

return (string) end($parts);
return end($parts);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function bucketSort(array $uniqueTestLocations): iterable
// This is a very hot path. Factoring here another method just to test this math may not be as good idea.

// Quick drop off lower bits, reducing precision to 8th of a second
$msTime = $location->getExecutionTime() * 1024 >> 7; // * 1024 / 128
$msTime = ($location->getExecutionTime() ?? 0) * 1024 >> 7; // * 1024 / 128

// For anything above 4 seconds reduce precision to 4 seconds
if ($msTime > 32) {
Expand Down
1 change: 1 addition & 0 deletions src/TestFramework/PhpUnit/Adapter/PestAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
final class PestAdapterFactory implements TestFrameworkAdapterFactory
{
/**
* @param string[] $sourceDirectories
* @param list<string> $filteredSourceFilesToMutate
*/
public static function create(
Expand Down
2 changes: 1 addition & 1 deletion src/TestFramework/TestFrameworkExtraOptionsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public function filterForMutantProcess(string $actualExtraOptions, array $initia
Assert::notNull($actualExtraOptions);
}

return (string) preg_replace('/\s+/', ' ', trim($actualExtraOptions));
return preg_replace('/\s+/', ' ', trim($actualExtraOptions));
}
}

0 comments on commit ef4ddca

Please sign in to comment.