Skip to content

Commit

Permalink
Fix CS/WS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 24, 2023
1 parent 05ea64c commit 34a985d
Show file tree
Hide file tree
Showing 55 changed files with 344 additions and 344 deletions.
38 changes: 19 additions & 19 deletions src/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function stop(bool $append = true, TestStatus $status = null, array|false

$this->linesToBeIgnored = array_merge_recursive(
$this->linesToBeIgnored,
$linesToBeIgnored
$linesToBeIgnored,
);

$this->append($data, null, $append, $status, $linesToBeCovered, $linesToBeUsed, $linesToBeIgnored);
Expand Down Expand Up @@ -246,7 +246,7 @@ public function append(RawCodeCoverageData $rawData, string $id = null, bool $ap
$rawData,
$linesToBeCovered,
$linesToBeUsed,
$size
$size,
);

if (empty($rawData->lineCoverage())) {
Expand All @@ -267,7 +267,7 @@ public function append(RawCodeCoverageData $rawData, string $id = null, bool $ap
public function merge(self $that): void
{
$this->filter->includeFiles(
$that->filter()->files()
$that->filter()->files(),
);

$this->data->merge($that->data);
Expand Down Expand Up @@ -342,7 +342,7 @@ public function cacheDirectory(): string
{
if (!$this->cachesStaticAnalysis()) {
throw new StaticAnalysisCacheNotConfiguredException(
'The static analysis cache is not configured'
'The static analysis cache is not configured',
);
}

Expand Down Expand Up @@ -436,12 +436,12 @@ private function applyExecutableLinesFilter(RawCodeCoverageData $data): void

$data->keepLineCoverageDataOnlyForLines(
$filename,
array_keys($linesToBranchMap)
array_keys($linesToBranchMap),
);

$data->markExecutableLineByBranch(
$filename,
$linesToBranchMap
$linesToBranchMap,
);
}
}
Expand All @@ -459,13 +459,13 @@ private function applyIgnoredLinesFilter(RawCodeCoverageData $data, array $lines
if (isset($linesToBeIgnored[$filename])) {
$data->removeCoverageDataForLines(
$filename,
$linesToBeIgnored[$filename]
$linesToBeIgnored[$filename],
);
}

$data->removeCoverageDataForLines(
$filename,
$this->analyser()->ignoredLinesFor($filename)
$this->analyser()->ignoredLinesFor($filename),
);
}
}
Expand All @@ -477,18 +477,18 @@ private function addUncoveredFilesFromFilter(): void
{
$uncoveredFiles = array_diff(
$this->filter->files(),
$this->data->coveredFiles()
$this->data->coveredFiles(),
);

foreach ($uncoveredFiles as $uncoveredFile) {
if (is_file($uncoveredFile)) {
$this->append(
RawCodeCoverageData::fromUncoveredFile(
$uncoveredFile,
$this->analyser()
$this->analyser(),
),
self::UNCOVERED_FILES,
linesToBeIgnored: $this->linesToBeIgnored
linesToBeIgnored: $this->linesToBeIgnored,
);
}
}
Expand All @@ -502,7 +502,7 @@ private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $dat
{
$allowedLines = $this->getAllowedLines(
$linesToBeCovered,
$linesToBeUsed
$linesToBeUsed,
);

$unintentionallyCoveredUnits = [];
Expand All @@ -519,7 +519,7 @@ private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $dat

if (!empty($unintentionallyCoveredUnits)) {
throw new UnintentionallyCoveredCodeException(
$unintentionallyCoveredUnits
$unintentionallyCoveredUnits,
);
}
}
Expand All @@ -535,7 +535,7 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed):

$allowedLines[$file] = array_merge(
$allowedLines[$file],
$linesToBeCovered[$file]
$linesToBeCovered[$file],
);
}

Expand All @@ -546,13 +546,13 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed):

$allowedLines[$file] = array_merge(
$allowedLines[$file],
$linesToBeUsed[$file]
$linesToBeUsed[$file],
);
}

foreach (array_keys($allowedLines) as $file) {
$allowedLines[$file] = array_flip(
array_unique($allowedLines[$file])
array_unique($allowedLines[$file]),
);
}

Expand Down Expand Up @@ -592,7 +592,7 @@ private function processUnintentionallyCoveredUnits(array $unintentionallyCovere
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}

Expand All @@ -614,15 +614,15 @@ private function analyser(): FileAnalyser

$this->analyser = new ParsingFileAnalyser(
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
$this->ignoreDeprecatedCode,
);

if ($this->cachesStaticAnalysis()) {
$this->analyser = new CachingFileAnalyser(
$this->cacheDirectory,
$this->analyser,
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
$this->ignoreDeprecatedCode,
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Data/ProcessedCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ public function merge(self $newData): void
$compareLineNumbers = array_unique(
array_merge(
array_keys($this->lineCoverage[$file]),
array_keys($newData->lineCoverage[$file])
)
array_keys($newData->lineCoverage[$file]),
),
);

foreach ($compareLineNumbers as $line) {
Expand All @@ -176,7 +176,7 @@ public function merge(self $newData): void
$this->lineCoverage[$file][$line] = $newData->lineCoverage[$file][$line];
} elseif ($thatPriority === $thisPriority && is_array($this->lineCoverage[$file][$line])) {
$this->lineCoverage[$file][$line] = array_unique(
array_merge($this->lineCoverage[$file][$line], $newData->lineCoverage[$file][$line])
array_merge($this->lineCoverage[$file][$line], $newData->lineCoverage[$file][$line]),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Data/RawCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function keepLineCoverageDataOnlyForLines(string $filename, array $lines)

$this->lineCoverage[$filename] = array_intersect_key(
$this->lineCoverage[$filename],
array_flip($lines)
array_flip($lines),
);
}

Expand Down Expand Up @@ -223,7 +223,7 @@ public function removeCoverageDataForLines(string $filename, array $lines): void

$this->lineCoverage[$filename] = array_diff_key(
$this->lineCoverage[$filename],
array_flip($lines)
array_flip($lines),
);

if (isset($this->functionCoverage[$filename])) {
Expand Down
8 changes: 4 additions & 4 deletions src/Driver/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function enableBranchAndPathCoverage(): void
throw new BranchAndPathCoverageNotSupportedException(
sprintf(
'%s does not support branch and path coverage',
$this->nameAndVersion()
)
$this->nameAndVersion(),
),
);
}

Expand Down Expand Up @@ -107,8 +107,8 @@ public function enableDeadCodeDetection(): void
throw new DeadCodeDetectionNotSupportedException(
sprintf(
'%s does not support dead code detection',
$this->nameAndVersion()
)
$this->nameAndVersion(),
),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Driver/XdebugDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(Filter $filter)
xdebug_set_filter(
XDEBUG_FILTER_CODE_COVERAGE,
XDEBUG_PATH_INCLUDE,
$filter->files()
$filter->files(),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Node/AbstractNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ public function percentageOfExecutedBranches(): Percentage
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedBranches(),
$this->numberOfExecutableBranches()
$this->numberOfExecutableBranches(),
);
}

public function percentageOfExecutedPaths(): Percentage
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedPaths(),
$this->numberOfExecutablePaths()
$this->numberOfExecutablePaths(),
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Node/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public function build(CodeCoverage $coverage): Directory
$commonPath = $this->reducePaths($data);
$root = new Directory(
$commonPath,
null
null,
);

$this->addItems(
$root,
$this->buildDirectoryStructure($data),
$coverage->getTests()
$coverage->getTests(),
);

return $root;
Expand Down Expand Up @@ -80,8 +80,8 @@ private function addItems(Directory $root, array $items, array $tests): void
$this->analyser->classesIn($filename),
$this->analyser->traitsIn($filename),
$this->analyser->functionsIn($filename),
$this->analyser->linesOfCodeFor($filename)
)
$this->analyser->linesOfCodeFor($filename),
),
);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Node/CrapIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function asString(): string

return sprintf(
'%01.2F',
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity,
);
}
}
12 changes: 6 additions & 6 deletions src/Node/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getIterator(): RecursiveIteratorIterator
{
return new RecursiveIteratorIterator(
new Iterator($this),
RecursiveIteratorIterator::SELF_FIRST
RecursiveIteratorIterator::SELF_FIRST,
);
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public function classes(): array
foreach ($this->children as $child) {
$this->classes = array_merge(
$this->classes,
$child->classes()
$child->classes(),
);
}
}
Expand All @@ -138,7 +138,7 @@ public function traits(): array
foreach ($this->children as $child) {
$this->traits = array_merge(
$this->traits,
$child->traits()
$child->traits(),
);
}
}
Expand All @@ -154,7 +154,7 @@ public function functions(): array
foreach ($this->children as $child) {
$this->functions = array_merge(
$this->functions,
$child->functions()
$child->functions(),
);
}
}
Expand All @@ -177,8 +177,8 @@ public function linesOfCode(): array
foreach ($this->children as $child) {
$childLinesOfCode = $child->linesOfCode();

$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['nonCommentLinesOfCode'] += $childLinesOfCode['nonCommentLinesOfCode'];
}
}
Expand Down
Loading

0 comments on commit 34a985d

Please sign in to comment.