diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php index f22b5f76c..0fe09e277 100644 --- a/src/CodeCoverage.php +++ b/src/CodeCoverage.php @@ -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); @@ -246,7 +246,7 @@ public function append(RawCodeCoverageData $rawData, string $id = null, bool $ap $rawData, $linesToBeCovered, $linesToBeUsed, - $size + $size, ); if (empty($rawData->lineCoverage())) { @@ -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); @@ -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', ); } @@ -436,12 +436,12 @@ private function applyExecutableLinesFilter(RawCodeCoverageData $data): void $data->keepLineCoverageDataOnlyForLines( $filename, - array_keys($linesToBranchMap) + array_keys($linesToBranchMap), ); $data->markExecutableLineByBranch( $filename, - $linesToBranchMap + $linesToBranchMap, ); } } @@ -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), ); } } @@ -477,7 +477,7 @@ private function addUncoveredFilesFromFilter(): void { $uncoveredFiles = array_diff( $this->filter->files(), - $this->data->coveredFiles() + $this->data->coveredFiles(), ); foreach ($uncoveredFiles as $uncoveredFile) { @@ -485,10 +485,10 @@ private function addUncoveredFilesFromFilter(): void $this->append( RawCodeCoverageData::fromUncoveredFile( $uncoveredFile, - $this->analyser() + $this->analyser(), ), self::UNCOVERED_FILES, - linesToBeIgnored: $this->linesToBeIgnored + linesToBeIgnored: $this->linesToBeIgnored, ); } } @@ -502,7 +502,7 @@ private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $dat { $allowedLines = $this->getAllowedLines( $linesToBeCovered, - $linesToBeUsed + $linesToBeUsed, ); $unintentionallyCoveredUnits = []; @@ -519,7 +519,7 @@ private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $dat if (!empty($unintentionallyCoveredUnits)) { throw new UnintentionallyCoveredCodeException( - $unintentionallyCoveredUnits + $unintentionallyCoveredUnits, ); } } @@ -535,7 +535,7 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed): $allowedLines[$file] = array_merge( $allowedLines[$file], - $linesToBeCovered[$file] + $linesToBeCovered[$file], ); } @@ -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]), ); } @@ -592,7 +592,7 @@ private function processUnintentionallyCoveredUnits(array $unintentionallyCovere throw new ReflectionException( $e->getMessage(), $e->getCode(), - $e + $e, ); } @@ -614,7 +614,7 @@ private function analyser(): FileAnalyser $this->analyser = new ParsingFileAnalyser( $this->useAnnotationsForIgnoringCode, - $this->ignoreDeprecatedCode + $this->ignoreDeprecatedCode, ); if ($this->cachesStaticAnalysis()) { @@ -622,7 +622,7 @@ private function analyser(): FileAnalyser $this->cacheDirectory, $this->analyser, $this->useAnnotationsForIgnoringCode, - $this->ignoreDeprecatedCode + $this->ignoreDeprecatedCode, ); } diff --git a/src/Data/ProcessedCodeCoverageData.php b/src/Data/ProcessedCodeCoverageData.php index 550c037a2..28834c244 100644 --- a/src/Data/ProcessedCodeCoverageData.php +++ b/src/Data/ProcessedCodeCoverageData.php @@ -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) { @@ -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]), ); } } diff --git a/src/Data/RawCodeCoverageData.php b/src/Data/RawCodeCoverageData.php index da7522df6..49cefbbe1 100644 --- a/src/Data/RawCodeCoverageData.php +++ b/src/Data/RawCodeCoverageData.php @@ -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), ); } @@ -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])) { diff --git a/src/Driver/Driver.php b/src/Driver/Driver.php index 31c4e644c..cfbed9cfc 100644 --- a/src/Driver/Driver.php +++ b/src/Driver/Driver.php @@ -75,8 +75,8 @@ public function enableBranchAndPathCoverage(): void throw new BranchAndPathCoverageNotSupportedException( sprintf( '%s does not support branch and path coverage', - $this->nameAndVersion() - ) + $this->nameAndVersion(), + ), ); } @@ -107,8 +107,8 @@ public function enableDeadCodeDetection(): void throw new DeadCodeDetectionNotSupportedException( sprintf( '%s does not support dead code detection', - $this->nameAndVersion() - ) + $this->nameAndVersion(), + ), ); } diff --git a/src/Driver/XdebugDriver.php b/src/Driver/XdebugDriver.php index 3123de6eb..37f4572d4 100644 --- a/src/Driver/XdebugDriver.php +++ b/src/Driver/XdebugDriver.php @@ -75,7 +75,7 @@ public function __construct(Filter $filter) xdebug_set_filter( XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_INCLUDE, - $filter->files() + $filter->files(), ); } } diff --git a/src/Node/AbstractNode.php b/src/Node/AbstractNode.php index 214258e78..6338ed3d0 100644 --- a/src/Node/AbstractNode.php +++ b/src/Node/AbstractNode.php @@ -131,7 +131,7 @@ public function percentageOfExecutedBranches(): Percentage { return Percentage::fromFractionAndTotal( $this->numberOfExecutedBranches(), - $this->numberOfExecutableBranches() + $this->numberOfExecutableBranches(), ); } @@ -139,7 +139,7 @@ public function percentageOfExecutedPaths(): Percentage { return Percentage::fromFractionAndTotal( $this->numberOfExecutedPaths(), - $this->numberOfExecutablePaths() + $this->numberOfExecutablePaths(), ); } diff --git a/src/Node/Builder.php b/src/Node/Builder.php index a2885752b..5ed6f866a 100644 --- a/src/Node/Builder.php +++ b/src/Node/Builder.php @@ -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; @@ -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 { diff --git a/src/Node/CrapIndex.php b/src/Node/CrapIndex.php index 8992346cd..7173276c6 100644 --- a/src/Node/CrapIndex.php +++ b/src/Node/CrapIndex.php @@ -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, ); } } diff --git a/src/Node/Directory.php b/src/Node/Directory.php index 8e71f6460..176318bde 100644 --- a/src/Node/Directory.php +++ b/src/Node/Directory.php @@ -76,7 +76,7 @@ public function getIterator(): RecursiveIteratorIterator { return new RecursiveIteratorIterator( new Iterator($this), - RecursiveIteratorIterator::SELF_FIRST + RecursiveIteratorIterator::SELF_FIRST, ); } @@ -122,7 +122,7 @@ public function classes(): array foreach ($this->children as $child) { $this->classes = array_merge( $this->classes, - $child->classes() + $child->classes(), ); } } @@ -138,7 +138,7 @@ public function traits(): array foreach ($this->children as $child) { $this->traits = array_merge( $this->traits, - $child->traits() + $child->traits(), ); } } @@ -154,7 +154,7 @@ public function functions(): array foreach ($this->children as $child) { $this->functions = array_merge( $this->functions, - $child->functions() + $child->functions(), ); } } @@ -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']; } } diff --git a/src/Node/File.php b/src/Node/File.php index 120ebd27a..7029e8a5f 100644 --- a/src/Node/File.php +++ b/src/Node/File.php @@ -487,14 +487,14 @@ private function processClasses(array $classes): void $this->classes[$className]['methods'][$methodName] = $methodData; $this->classes[$className]['executableBranches'] += $methodData['executableBranches']; - $this->classes[$className]['executedBranches'] += $methodData['executedBranches']; - $this->classes[$className]['executablePaths'] += $methodData['executablePaths']; - $this->classes[$className]['executedPaths'] += $methodData['executedPaths']; + $this->classes[$className]['executedBranches'] += $methodData['executedBranches']; + $this->classes[$className]['executablePaths'] += $methodData['executablePaths']; + $this->classes[$className]['executedPaths'] += $methodData['executedPaths']; $this->numExecutableBranches += $methodData['executableBranches']; - $this->numExecutedBranches += $methodData['executedBranches']; - $this->numExecutablePaths += $methodData['executablePaths']; - $this->numExecutedPaths += $methodData['executedPaths']; + $this->numExecutedBranches += $methodData['executedBranches']; + $this->numExecutablePaths += $methodData['executablePaths']; + $this->numExecutedPaths += $methodData['executedPaths']; foreach (range($method['startLine'], $method['endLine']) as $lineNumber) { $this->codeUnitsByLine[$lineNumber] = [ @@ -536,14 +536,14 @@ private function processTraits(array $traits): void $this->traits[$traitName]['methods'][$methodName] = $methodData; $this->traits[$traitName]['executableBranches'] += $methodData['executableBranches']; - $this->traits[$traitName]['executedBranches'] += $methodData['executedBranches']; - $this->traits[$traitName]['executablePaths'] += $methodData['executablePaths']; - $this->traits[$traitName]['executedPaths'] += $methodData['executedPaths']; + $this->traits[$traitName]['executedBranches'] += $methodData['executedBranches']; + $this->traits[$traitName]['executablePaths'] += $methodData['executablePaths']; + $this->traits[$traitName]['executedPaths'] += $methodData['executedPaths']; $this->numExecutableBranches += $methodData['executableBranches']; - $this->numExecutedBranches += $methodData['executedBranches']; - $this->numExecutablePaths += $methodData['executablePaths']; - $this->numExecutedPaths += $methodData['executedPaths']; + $this->numExecutedBranches += $methodData['executedBranches']; + $this->numExecutablePaths += $methodData['executablePaths']; + $this->numExecutedPaths += $methodData['executedPaths']; foreach (range($method['startLine'], $method['endLine']) as $lineNumber) { $this->codeUnitsByLine[$lineNumber] = [ @@ -587,7 +587,7 @@ private function processFunctions(array $functions): void if (isset($this->functionCoverageData[$functionName]['branches'])) { $this->functions[$functionName]['executableBranches'] = count( - $this->functionCoverageData[$functionName]['branches'] + $this->functionCoverageData[$functionName]['branches'], ); $this->functions[$functionName]['executedBranches'] = count( @@ -596,14 +596,14 @@ private function processFunctions(array $functions): void static function (array $branch) { return (bool) $branch['hit']; - } - ) + }, + ), ); } if (isset($this->functionCoverageData[$functionName]['paths'])) { $this->functions[$functionName]['executablePaths'] = count( - $this->functionCoverageData[$functionName]['paths'] + $this->functionCoverageData[$functionName]['paths'], ); $this->functions[$functionName]['executedPaths'] = count( @@ -612,15 +612,15 @@ static function (array $branch) static function (array $path) { return (bool) $path['hit']; - } - ) + }, + ), ); } $this->numExecutableBranches += $this->functions[$functionName]['executableBranches']; - $this->numExecutedBranches += $this->functions[$functionName]['executedBranches']; - $this->numExecutablePaths += $this->functions[$functionName]['executablePaths']; - $this->numExecutedPaths += $this->functions[$functionName]['executedPaths']; + $this->numExecutedBranches += $this->functions[$functionName]['executedBranches']; + $this->numExecutablePaths += $this->functions[$functionName]['executablePaths']; + $this->numExecutedPaths += $this->functions[$functionName]['executedPaths']; } } @@ -653,7 +653,7 @@ private function newMethod(string $className, string $methodName, array $method, if (isset($this->functionCoverageData[$key]['branches'])) { $methodData['executableBranches'] = count( - $this->functionCoverageData[$key]['branches'] + $this->functionCoverageData[$key]['branches'], ); $methodData['executedBranches'] = count( @@ -662,14 +662,14 @@ private function newMethod(string $className, string $methodName, array $method, static function (array $branch) { return (bool) $branch['hit']; - } - ) + }, + ), ); } if (isset($this->functionCoverageData[$key]['paths'])) { $methodData['executablePaths'] = count( - $this->functionCoverageData[$key]['paths'] + $this->functionCoverageData[$key]['paths'], ); $methodData['executedPaths'] = count( @@ -678,8 +678,8 @@ static function (array $branch) static function (array $path) { return (bool) $path['hit']; - } - ) + }, + ), ); } diff --git a/src/Report/Clover.php b/src/Report/Clover.php index 08ba148b5..8a24236f9 100644 --- a/src/Report/Clover.php +++ b/src/Report/Clover.php @@ -16,7 +16,7 @@ use function ksort; use function max; use function range; -use function strpos; +use function str_contains; use function time; use DOMDocument; use SebastianBergmann\CodeCoverage\CodeCoverage; @@ -79,7 +79,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string } $classMethods++; - $classStatements += $method['executableLines']; + $classStatements += $method['executableLines']; $coveredClassStatements += $method['executedLines']; if ($method['coverage'] == 100) { @@ -115,28 +115,28 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string if (!empty($class['package']['fullPackage'])) { $xmlClass->setAttribute( 'fullPackage', - $class['package']['fullPackage'] + $class['package']['fullPackage'], ); } if (!empty($class['package']['category'])) { $xmlClass->setAttribute( 'category', - $class['package']['category'] + $class['package']['category'], ); } if (!empty($class['package']['package'])) { $xmlClass->setAttribute( 'package', - $class['package']['package'] + $class['package']['package'], ); } if (!empty($class['package']['subpackage'])) { $xmlClass->setAttribute( 'subpackage', - $class['package']['subpackage'] + $class['package']['subpackage'], ); } @@ -213,7 +213,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string } else { if (!isset($packages[$namespace])) { $packages[$namespace] = $xmlDocument->createElement( - 'package' + 'package', ); $packages[$namespace]->setAttribute('name', $namespace); @@ -244,7 +244,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string $buffer = $xmlDocument->saveXML(); if ($target !== null) { - if (!strpos($target, '://') !== false) { + if (!str_contains($target, '://')) { Filesystem::createDirectory(dirname($target)); } diff --git a/src/Report/Cobertura.php b/src/Report/Cobertura.php index 0ac267a03..7ff5582df 100644 --- a/src/Report/Cobertura.php +++ b/src/Report/Cobertura.php @@ -15,8 +15,8 @@ use function file_put_contents; use function preg_match; use function range; +use function str_contains; use function str_replace; -use function strpos; use function time; use DOMImplementation; use SebastianBergmann\CodeCoverage\CodeCoverage; @@ -40,7 +40,7 @@ public function process(CodeCoverage $coverage, ?string $target = null): string $documentType = $implementation->createDocumentType( 'coverage', '', - 'http://cobertura.sourceforge.net/xml/coverage-04.dtd' + 'http://cobertura.sourceforge.net/xml/coverage-04.dtd', ); $document = $implementation->createDocument('', '', $documentType); @@ -114,7 +114,7 @@ public function process(CodeCoverage $coverage, ?string $target = null): string $coverageData = $item->lineCoverageData(); foreach ($classes as $className => $class) { - $complexity += $class['ccn']; + $complexity += $class['ccn']; $packageComplexity += $class['ccn']; if (!empty($class['package']['namespace'])) { @@ -225,22 +225,22 @@ public function process(CodeCoverage $coverage, ?string $target = null): string continue; } - $complexity += $function['ccn']; - $packageComplexity += $function['ccn']; + $complexity += $function['ccn']; + $packageComplexity += $function['ccn']; $functionsComplexity += $function['ccn']; $linesValid = $function['executableLines']; $linesCovered = $function['executedLines']; $lineRate = $linesValid === 0 ? 0 : ($linesCovered / $linesValid); - $functionsLinesValid += $linesValid; + $functionsLinesValid += $linesValid; $functionsLinesCovered += $linesCovered; $branchesValid = $function['executableBranches']; $branchesCovered = $function['executedBranches']; $branchRate = $branchesValid === 0 ? 0 : ($branchesCovered / $branchesValid); - $functionsBranchesValid += $branchesValid; + $functionsBranchesValid += $branchesValid; $functionsBranchesCovered += $branchesValid; $methodElement = $document->createElement('method'); @@ -295,7 +295,7 @@ public function process(CodeCoverage $coverage, ?string $target = null): string $buffer = $document->saveXML(); if ($target !== null) { - if (!strpos($target, '://') !== false) { + if (!str_contains($target, '://')) { Filesystem::createDirectory(dirname($target)); } diff --git a/src/Report/Crap4j.php b/src/Report/Crap4j.php index 305e7e122..cb1bde605 100644 --- a/src/Report/Crap4j.php +++ b/src/Report/Crap4j.php @@ -15,7 +15,7 @@ use function htmlspecialchars; use function is_string; use function round; -use function strpos; +use function str_contains; use DOMDocument; use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; @@ -73,7 +73,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string foreach ($class['methods'] as $methodName => $method) { $crapLoad = $this->crapLoad((float) $method['crap'], $method['ccn'], $method['coverage']); - $fullCrap += $method['crap']; + $fullCrap += $method['crap']; $fullCrapLoad += $crapLoad; $fullMethodCount++; @@ -122,7 +122,7 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string $buffer = $document->saveXML(); if ($target !== null) { - if (!strpos($target, '://') !== false) { + if (!str_contains($target, '://')) { Filesystem::createDirectory(dirname($target)); } diff --git a/src/Report/Html/CustomCssFile.php b/src/Report/Html/CustomCssFile.php index 2e0a4fef2..70a7230c9 100644 --- a/src/Report/Html/CustomCssFile.php +++ b/src/Report/Html/CustomCssFile.php @@ -31,7 +31,7 @@ public static function from(string $path): self { if (!is_file($path)) { throw new InvalidArgumentException( - '$path does not exist' + '$path does not exist', ); } diff --git a/src/Report/Html/Facade.php b/src/Report/Html/Facade.php index ee8f1c315..b376eb5d1 100644 --- a/src/Report/Html/Facade.php +++ b/src/Report/Html/Facade.php @@ -50,7 +50,7 @@ public function process(CodeCoverage $coverage, string $target): void $this->generator, $date, $this->thresholds, - $coverage->collectsBranchAndPathCoverage() + $coverage->collectsBranchAndPathCoverage(), ); $directory = new Directory( @@ -58,7 +58,7 @@ public function process(CodeCoverage $coverage, string $target): void $this->generator, $date, $this->thresholds, - $coverage->collectsBranchAndPathCoverage() + $coverage->collectsBranchAndPathCoverage(), ); $file = new File( @@ -66,7 +66,7 @@ public function process(CodeCoverage $coverage, string $target): void $this->generator, $date, $this->thresholds, - $coverage->collectsBranchAndPathCoverage() + $coverage->collectsBranchAndPathCoverage(), ); $directory->render($report, $target . 'index.html'); @@ -126,7 +126,7 @@ private function renderCss(string $target): void 'success-high' => $this->colors->successHigh(), 'warning' => $this->colors->warning(), 'danger' => $this->colors->danger(), - ] + ], ); try { @@ -135,7 +135,7 @@ private function renderCss(string $target): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } } diff --git a/src/Report/Html/Renderer.php b/src/Report/Html/Renderer.php index cfc403e8c..6ce7b8fe4 100644 --- a/src/Report/Html/Renderer.php +++ b/src/Report/Html/Renderer.php @@ -55,7 +55,7 @@ protected function renderItemTemplate(Template $template, array $data): string $data['numClasses']; $classesBar = $this->coverageBar( - $data['testedClassesPercent'] + $data['testedClassesPercent'], ); } else { $classesLevel = ''; @@ -71,7 +71,7 @@ protected function renderItemTemplate(Template $template, array $data): string $data['numMethods']; $methodsBar = $this->coverageBar( - $data['testedMethodsPercent'] + $data['testedMethodsPercent'], ); } else { $methodsLevel = ''; @@ -87,7 +87,7 @@ protected function renderItemTemplate(Template $template, array $data): string $data['numExecutableLines']; $linesBar = $this->coverageBar( - $data['linesExecutedPercent'] + $data['linesExecutedPercent'], ); } else { $linesLevel = ''; @@ -103,7 +103,7 @@ protected function renderItemTemplate(Template $template, array $data): string $data['numExecutablePaths']; $pathsBar = $this->coverageBar( - $data['pathsExecutedPercent'] + $data['pathsExecutedPercent'], ); } else { $pathsLevel = ''; @@ -119,7 +119,7 @@ protected function renderItemTemplate(Template $template, array $data): string $data['numExecutableBranches']; $branchesBar = $this->coverageBar( - $data['branchesExecutedPercent'] + $data['branchesExecutedPercent'], ); } else { $branchesLevel = ''; @@ -153,7 +153,7 @@ protected function renderItemTemplate(Template $template, array $data): string 'classes_tested_percent' => $data['testedClassesPercentAsString'] ?? '', 'classes_level' => $classesLevel, 'classes_number' => $classesNumber, - ] + ], ); return $template->render(); @@ -173,7 +173,7 @@ protected function setCommonTemplateVariables(Template $template, AbstractNode $ 'generator' => $this->generator, 'low_upper_bound' => $this->thresholds->lowUpperBound(), 'high_lower_bound' => $this->thresholds->highLowerBound(), - ] + ], ); } @@ -196,7 +196,7 @@ protected function breadcrumbs(AbstractNode $node): string if ($step !== $node) { $breadcrumbs .= $this->inactiveBreadcrumb( $step, - array_pop($pathToRoot) + array_pop($pathToRoot), ); } else { $breadcrumbs .= $this->activeBreadcrumb($step); @@ -210,7 +210,7 @@ protected function activeBreadcrumb(AbstractNode $node): string { $buffer = sprintf( ' ' . "\n", - $node->name() + $node->name(), ); if ($node instanceof DirectoryNode) { @@ -225,7 +225,7 @@ protected function inactiveBreadcrumb(AbstractNode $node, string $pathToRoot): s return sprintf( ' ' . "\n", $pathToRoot, - $node->name() + $node->name(), ); } @@ -250,7 +250,7 @@ protected function coverageBar(float $percent): string $template = new Template( $templateName, '{{', - '}}' + '}}', ); $template->setVar(['level' => $level, 'percent' => sprintf('%.2F', $percent)]); @@ -280,7 +280,7 @@ private function runtimeString(): string '%s %s', $runtime->getVendorUrl(), $runtime->getName(), - $runtime->getVersion() + $runtime->getVersion(), ); } } diff --git a/src/Report/Html/Renderer/Dashboard.php b/src/Report/Html/Renderer/Dashboard.php index 4cb220e8f..cf21cf9dd 100644 --- a/src/Report/Html/Renderer/Dashboard.php +++ b/src/Report/Html/Renderer/Dashboard.php @@ -36,7 +36,7 @@ public function render(DirectoryNode $node, string $file): void $template = new Template( $templateName, '{{', - '}}' + '}}', ); $this->setCommonTemplateVariables($template, $node); @@ -57,7 +57,7 @@ public function render(DirectoryNode $node, string $file): void 'complexity_method' => $complexity['method'], 'class_coverage_distribution' => $coverageDistribution['class'], 'method_coverage_distribution' => $coverageDistribution['method'], - ] + ], ); try { @@ -66,7 +66,7 @@ public function render(DirectoryNode $node, string $file): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } } @@ -76,7 +76,7 @@ protected function activeBreadcrumb(AbstractNode $node): string return sprintf( ' ' . "\n" . ' ' . "\n", - $node->name() + $node->name(), ); } @@ -99,7 +99,7 @@ private function complexity(array $classes, string $baseLink): array sprintf( '%s', str_replace($baseLink, '', $method['link']), - $methodName + $methodName, ), ]; } @@ -110,7 +110,7 @@ private function complexity(array $classes, string $baseLink): array sprintf( '%s', str_replace($baseLink, '', $class['link']), - $className + $className, ), ]; } @@ -222,7 +222,7 @@ private function insufficientCoverage(array $classes, string $baseLink): array ' %s%d%%' . "\n", str_replace($baseLink, '', $classes[$className]['link']), $className, - $coverage + $coverage, ); } @@ -234,7 +234,7 @@ private function insufficientCoverage(array $classes, string $baseLink): array str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), $methodName, $method, - $coverage + $coverage, ); } @@ -277,7 +277,7 @@ private function projectRisks(array $classes, string $baseLink): array ' %s%d' . "\n", str_replace($baseLink, '', $classes[$className]['link']), $className, - $crap + $crap, ); } @@ -289,7 +289,7 @@ private function projectRisks(array $classes, string $baseLink): array str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), $methodName, $method, - $crap + $crap, ); } diff --git a/src/Report/Html/Renderer/Directory.php b/src/Report/Html/Renderer/Directory.php index c6f885f23..1d7334b3a 100644 --- a/src/Report/Html/Renderer/Directory.php +++ b/src/Report/Html/Renderer/Directory.php @@ -44,7 +44,7 @@ public function render(DirectoryNode $node, string $file): void [ 'id' => $node->id(), 'items' => $items, - ] + ], ); try { @@ -53,7 +53,7 @@ public function render(DirectoryNode $node, string $file): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } } @@ -93,7 +93,7 @@ private function renderItem(Node $node, bool $total = false): string $data['name'] = sprintf( '%s', $node->name(), - $node->name() + $node->name(), ); $data['icon'] = sprintf('', $up); } elseif ($this->hasBranchCoverage) { @@ -102,13 +102,13 @@ private function renderItem(Node $node, bool $total = false): string $node->name(), $node->name(), $node->name(), - $node->name() + $node->name(), ); } else { $data['name'] = sprintf( '%s', $node->name(), - $node->name() + $node->name(), ); } } @@ -117,7 +117,7 @@ private function renderItem(Node $node, bool $total = false): string return $this->renderItemTemplate( new Template($templateName, '{{', '}}'), - $data + $data, ); } } diff --git a/src/Report/Html/Renderer/File.php b/src/Report/Html/Renderer/File.php index eb98623d6..005c1db3f 100644 --- a/src/Report/Html/Renderer/File.php +++ b/src/Report/Html/Renderer/File.php @@ -196,7 +196,7 @@ public function render(FileNode $node, string $file): void 'lines' => $this->renderSourceWithLineCoverage($node), 'legend' => '

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

', 'structure' => '', - ] + ], ); try { @@ -205,7 +205,7 @@ public function render(FileNode $node, string $file): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } @@ -216,7 +216,7 @@ public function render(FileNode $node, string $file): void 'lines' => $this->renderSourceWithBranchCoverage($node), 'legend' => '

Fully coveredPartially coveredNot covered

', 'structure' => $this->renderBranchStructure($node), - ] + ], ); try { @@ -225,7 +225,7 @@ public function render(FileNode $node, string $file): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } @@ -235,7 +235,7 @@ public function render(FileNode $node, string $file): void 'lines' => $this->renderSourceWithPathCoverage($node), 'legend' => '

Fully coveredPartially coveredNot covered

', 'structure' => $this->renderPathStructure($node), - ] + ], ); try { @@ -244,7 +244,7 @@ public function render(FileNode $node, string $file): void throw new FileCouldNotBeWrittenException( $e->getMessage(), $e->getCode(), - $e + $e, ); } } @@ -259,7 +259,7 @@ private function renderItems(FileNode $node): string $methodItemTemplate = new Template( $methodTemplateName, '{{', - '}}' + '}}', ); $items = $this->renderItemTemplate( @@ -287,24 +287,24 @@ private function renderItems(FileNode $node): string 'testedClassesPercent' => $node->percentageOfTestedClassesAndTraits()->asFloat(), 'testedClassesPercentAsString' => $node->percentageOfTestedClassesAndTraits()->asString(), 'crap' => 'CRAP', - ] + ], ); $items .= $this->renderFunctionItems( $node->functions(), - $methodItemTemplate + $methodItemTemplate, ); $items .= $this->renderTraitOrClassItems( $node->traits(), $template, - $methodItemTemplate + $methodItemTemplate, ); $items .= $this->renderTraitOrClassItems( $node->classes(), $template, - $methodItemTemplate + $methodItemTemplate, ); return $items; @@ -337,15 +337,15 @@ private function renderTraitOrClassItems(array $items, Template $template, Templ $numTestedClasses = $numTestedMethods === $numMethods ? 1 : 0; $linesExecutedPercentAsString = Percentage::fromFractionAndTotal( $item['executedLines'], - $item['executableLines'] + $item['executableLines'], )->asString(); $branchesExecutedPercentAsString = Percentage::fromFractionAndTotal( $item['executedBranches'], - $item['executableBranches'] + $item['executableBranches'], )->asString(); $pathsExecutedPercentAsString = Percentage::fromFractionAndTotal( $item['executedPaths'], - $item['executablePaths'] + $item['executablePaths'], )->asString(); } else { $numClasses = 0; @@ -357,12 +357,12 @@ private function renderTraitOrClassItems(array $items, Template $template, Templ $testedMethodsPercentage = Percentage::fromFractionAndTotal( $numTestedMethods, - $numMethods + $numMethods, ); $testedClassesPercentage = Percentage::fromFractionAndTotal( $numTestedMethods === $numMethods ? 1 : 0, - 1 + 1, ); $buffer .= $this->renderItemTemplate( @@ -389,7 +389,7 @@ private function renderTraitOrClassItems(array $items, Template $template, Templ 'numExecutableBranches' => $item['executableBranches'], 'pathsExecutedPercent' => Percentage::fromFractionAndTotal( $item['executedPaths'], - $item['executablePaths'] + $item['executablePaths'], )->asFloat(), 'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString, 'numExecutedPaths' => $item['executedPaths'], @@ -399,14 +399,14 @@ private function renderTraitOrClassItems(array $items, Template $template, Templ 'testedClassesPercent' => $testedClassesPercentage->asFloat(), 'testedClassesPercentAsString' => $testedClassesPercentage->asString(), 'crap' => $item['crap'], - ] + ], ); foreach ($item['methods'] as $method) { $buffer .= $this->renderFunctionOrMethodItem( $methodItemTemplate, $method, - ' ' + ' ', ); } } @@ -425,7 +425,7 @@ private function renderFunctionItems(array $functions, Template $template): stri foreach ($functions as $function) { $buffer .= $this->renderFunctionOrMethodItem( $template, - $function + $function, ); } @@ -447,22 +447,22 @@ private function renderFunctionOrMethodItem(Template $template, array $item, str $executedLinesPercentage = Percentage::fromFractionAndTotal( $item['executedLines'], - $item['executableLines'] + $item['executableLines'], ); $executedBranchesPercentage = Percentage::fromFractionAndTotal( $item['executedBranches'], - $item['executableBranches'] + $item['executableBranches'], ); $executedPathsPercentage = Percentage::fromFractionAndTotal( $item['executedPaths'], - $item['executablePaths'] + $item['executablePaths'], ); $testedMethodsPercentage = Percentage::fromFractionAndTotal( $numTestedMethods, - 1 + 1, ); return $this->renderItemTemplate( @@ -473,7 +473,7 @@ private function renderFunctionOrMethodItem(Template $template, array $item, str $indent, $item['startLine'], htmlspecialchars($item['signature'], $this->htmlSpecialCharsFlags), - $item['functionName'] ?? $item['methodName'] + $item['functionName'] ?? $item['methodName'], ), 'numMethods' => $numMethods, 'numTestedMethods' => $numTestedMethods, @@ -492,7 +492,7 @@ private function renderFunctionOrMethodItem(Template $template, array $item, str 'testedMethodsPercent' => $testedMethodsPercentage->asFloat(), 'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(), 'crap' => $item['crap'], - ] + ], ); } @@ -550,7 +550,7 @@ private function renderSourceWithLineCoverage(FileNode $node): string $popover = sprintf( ' data-title="%s" data-content="%s" data-placement="top" data-html="true"', $popoverTitle, - htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags), ); } @@ -637,7 +637,7 @@ private function renderSourceWithBranchCoverage(FileNode $node): string $popover = sprintf( ' data-title="%s" data-content="%s" data-placement="top" data-html="true"', $popoverTitle, - htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags), ); } @@ -727,7 +727,7 @@ private function renderSourceWithPathCoverage(FileNode $node): string $popover = sprintf( ' data-title="%s" data-content="%s" data-placement="top" data-html="true"', $popoverTitle, - htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags), ); } @@ -825,7 +825,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD $popover = sprintf( ' data-title="%s" data-content="%s" data-placement="top" data-html="true"', $popoverTitle, - htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags), ); } @@ -940,7 +940,7 @@ private function renderPathLines(array $path, array $branches, array $codeLines, $popover = sprintf( ' data-title="%s" data-content="%s" data-placement="top" data-html="true"', $popoverTitle, - htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags), ); } @@ -965,7 +965,7 @@ private function renderLine(Template $template, int $lineNumber, string $lineCon 'lineContent' => $lineContent, 'class' => $class, 'popover' => $popover, - ] + ], ); return $template->render(); @@ -991,14 +991,14 @@ private function loadFile(string $file): array if ($token === '"' && $tokens[$j - 1] !== '\\') { $result[$i] .= sprintf( '%s', - htmlspecialchars($token, $this->htmlSpecialCharsFlags) + htmlspecialchars($token, $this->htmlSpecialCharsFlags), ); $stringFlag = !$stringFlag; } else { $result[$i] .= sprintf( '%s', - htmlspecialchars($token, $this->htmlSpecialCharsFlags) + htmlspecialchars($token, $this->htmlSpecialCharsFlags), ); } @@ -1010,7 +1010,7 @@ private function loadFile(string $file): array $value = str_replace( ["\t", ' '], ['    ', ' '], - htmlspecialchars($value, $this->htmlSpecialCharsFlags) + htmlspecialchars($value, $this->htmlSpecialCharsFlags), ); if ($value === "\n") { @@ -1039,7 +1039,7 @@ private function loadFile(string $file): array $result[$i] .= sprintf( '%s', $colour, - $line + $line, ); } @@ -1067,7 +1067,7 @@ private function abbreviateClassName(string $className): string $className = sprintf( '%s', $className, - array_pop($tmp) + array_pop($tmp), ); } @@ -1109,7 +1109,7 @@ private function createPopoverContentForTest(string $test, array $testData): str return sprintf( '%s', $testCSS, - htmlspecialchars($test, $this->htmlSpecialCharsFlags) + htmlspecialchars($test, $this->htmlSpecialCharsFlags), ); } diff --git a/src/Report/PHP.php b/src/Report/PHP.php index 1f8186d04..6f46f990f 100644 --- a/src/Report/PHP.php +++ b/src/Report/PHP.php @@ -12,7 +12,7 @@ use function dirname; use function file_put_contents; use function serialize; -use function strpos; +use function str_contains; use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; use SebastianBergmann\CodeCoverage\Util\Filesystem; @@ -27,7 +27,7 @@ public function process(CodeCoverage $coverage, ?string $target = null): string return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');'; if ($target !== null) { - if (!strpos($target, '://') !== false) { + if (!str_contains($target, '://')) { Filesystem::createDirectory(dirname($target)); } diff --git a/src/Report/Text.php b/src/Report/Text.php index 6f73dc168..ab8daae73 100644 --- a/src/Report/Text.php +++ b/src/Report/Text.php @@ -78,27 +78,27 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin if ($showColors) { $colors['classes'] = $this->coverageColor( $report->numberOfTestedClassesAndTraits(), - $report->numberOfClassesAndTraits() + $report->numberOfClassesAndTraits(), ); $colors['methods'] = $this->coverageColor( $report->numberOfTestedMethods(), - $report->numberOfMethods() + $report->numberOfMethods(), ); $colors['lines'] = $this->coverageColor( $report->numberOfExecutedLines(), - $report->numberOfExecutableLines() + $report->numberOfExecutableLines(), ); $colors['branches'] = $this->coverageColor( $report->numberOfExecutedBranches(), - $report->numberOfExecutableBranches() + $report->numberOfExecutableBranches(), ); $colors['paths'] = $this->coverageColor( $report->numberOfExecutedPaths(), - $report->numberOfExecutablePaths() + $report->numberOfExecutablePaths(), ); $colors['reset'] = self::COLOR_RESET; @@ -109,10 +109,10 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin ' Classes: %6s (%d/%d)', Percentage::fromFractionAndTotal( $report->numberOfTestedClassesAndTraits(), - $report->numberOfClassesAndTraits() + $report->numberOfClassesAndTraits(), )->asString(), $report->numberOfTestedClassesAndTraits(), - $report->numberOfClassesAndTraits() + $report->numberOfClassesAndTraits(), ); $methods = sprintf( @@ -122,7 +122,7 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin $report->numberOfMethods(), )->asString(), $report->numberOfTestedMethods(), - $report->numberOfMethods() + $report->numberOfMethods(), ); $paths = ''; @@ -136,7 +136,7 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin $report->numberOfExecutablePaths(), )->asString(), $report->numberOfExecutedPaths(), - $report->numberOfExecutablePaths() + $report->numberOfExecutablePaths(), ); $branches = sprintf( @@ -146,7 +146,7 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin $report->numberOfExecutableBranches(), )->asString(), $report->numberOfExecutedBranches(), - $report->numberOfExecutableBranches() + $report->numberOfExecutableBranches(), ); } @@ -157,7 +157,7 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin $report->numberOfExecutableLines(), )->asString(), $report->numberOfExecutedLines(), - $report->numberOfExecutableLines() + $report->numberOfExecutableLines(), ); $padding = max(array_map('strlen', [$classes, $methods, $lines])); @@ -215,12 +215,12 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin } $classMethods++; - $classExecutableLines += $method['executableLines']; - $classExecutedLines += $method['executedLines']; + $classExecutableLines += $method['executableLines']; + $classExecutedLines += $method['executedLines']; $classExecutableBranches += $method['executableBranches']; - $classExecutedBranches += $method['executedBranches']; - $classExecutablePaths += $method['executablePaths']; - $classExecutedPaths += $method['executedPaths']; + $classExecutedBranches += $method['executedBranches']; + $classExecutablePaths += $method['executablePaths']; + $classExecutedPaths += $method['executedPaths']; if ($method['coverage'] == 100) { $coveredMethods++; @@ -278,7 +278,7 @@ private function coverageColor(int $numberOfCoveredElements, int $totalNumberOfE { $coverage = Percentage::fromFractionAndTotal( $numberOfCoveredElements, - $totalNumberOfElements + $totalNumberOfElements, ); if ($coverage->asFloat() >= $this->thresholds->highLowerBound()) { @@ -298,13 +298,13 @@ private function printCoverageCounts(int $numberOfCoveredElements, int $totalNum return Percentage::fromFractionAndTotal( $numberOfCoveredElements, - $totalNumberOfElements + $totalNumberOfElements, )->asFixedWidthString() . ' (' . sprintf($format, $numberOfCoveredElements) . '/' . sprintf($format, $totalNumberOfElements) . ')'; } - private function format(string $color, int $padding, string|false $string): string + private function format(string $color, int $padding, false|string $string): string { $reset = $color ? self::COLOR_RESET : ''; diff --git a/src/Report/Thresholds.php b/src/Report/Thresholds.php index a1fa6e9f1..af6c6ce5b 100644 --- a/src/Report/Thresholds.php +++ b/src/Report/Thresholds.php @@ -31,7 +31,7 @@ public static function from(int $lowUpperBound, int $highLowerBound): self { if ($lowUpperBound > $highLowerBound) { throw new InvalidArgumentException( - '$lowUpperBound must not be larger than $highLowerBound' + '$lowUpperBound must not be larger than $highLowerBound', ); } diff --git a/src/Report/Xml/BuildInformation.php b/src/Report/Xml/BuildInformation.php index fac06ff4f..264bf713d 100644 --- a/src/Report/Xml/BuildInformation.php +++ b/src/Report/Xml/BuildInformation.php @@ -62,15 +62,15 @@ private function nodeByName(string $name): DOMElement { $node = $this->contextNode->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - $name + $name, )->item(0); if (!$node) { $node = $this->contextNode->appendChild( $this->contextNode->ownerDocument->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - $name - ) + $name, + ), ); } diff --git a/src/Report/Xml/Coverage.php b/src/Report/Xml/Coverage.php index 9c853ec25..bb41dfb59 100644 --- a/src/Report/Xml/Coverage.php +++ b/src/Report/Xml/Coverage.php @@ -55,7 +55,7 @@ public function finalize(): void $this->contextNode->parentNode->replaceChild( $fragment, - $this->contextNode + $this->contextNode, ); $this->finalized = true; diff --git a/src/Report/Xml/Facade.php b/src/Report/Xml/Facade.php index 8788200c4..3264718cf 100644 --- a/src/Report/Xml/Facade.php +++ b/src/Report/Xml/Facade.php @@ -64,7 +64,7 @@ public function process(CodeCoverage $coverage, string $target): void $report = $coverage->getReport(); $this->project = new Project( - $coverage->getReport()->name() + $coverage->getReport()->name(), ); $this->setBuildInformation(); @@ -132,14 +132,14 @@ private function processFile(FileNode $file, Directory $context): void { $fileObject = $context->addFile( $file->name(), - $file->id() . '.xml' + $file->id() . '.xml', ); $this->setTotals($file, $fileObject->totals()); $path = substr( $file->pathAsString(), - strlen($this->project->projectSourceDirectory()) + strlen($this->project->projectSourceDirectory()), ); $fileReport = new Report($path); @@ -169,7 +169,7 @@ private function processFile(FileNode $file, Directory $context): void } $fileReport->source()->setSourceCode( - file_get_contents($file->pathAsString()) + file_get_contents($file->pathAsString()), ); $this->saveDocument($fileReport->asDom(), $file->id()); @@ -186,7 +186,7 @@ private function processUnit(array $unit, Report $report): void $unitObject->setLines( $unit['startLine'], $unit['executableLines'], - $unit['executedLines'] + $unit['executedLines'], ); $unitObject->setCrap((float) $unit['crap']); @@ -200,7 +200,7 @@ private function processUnit(array $unit, Report $report): void $methodObject->setTotals( (string) $method['executableLines'], (string) $method['executedLines'], - (string) $method['coverage'] + (string) $method['coverage'], ); } } @@ -233,27 +233,27 @@ private function setTotals(AbstractNode $node, Totals $totals): void $loc['commentLinesOfCode'], $loc['nonCommentLinesOfCode'], $node->numberOfExecutableLines(), - $node->numberOfExecutedLines() + $node->numberOfExecutedLines(), ); $totals->setNumClasses( $node->numberOfClasses(), - $node->numberOfTestedClasses() + $node->numberOfTestedClasses(), ); $totals->setNumTraits( $node->numberOfTraits(), - $node->numberOfTestedTraits() + $node->numberOfTestedTraits(), ); $totals->setNumMethods( $node->numberOfMethods(), - $node->numberOfTestedMethods() + $node->numberOfTestedMethods(), ); $totals->setNumFunctions( $node->numberOfFunctions(), - $node->numberOfTestedFunctions() + $node->numberOfTestedFunctions(), ); } diff --git a/src/Report/Xml/File.php b/src/Report/Xml/File.php index a1da30a7d..69b275106 100644 --- a/src/Report/Xml/File.php +++ b/src/Report/Xml/File.php @@ -34,8 +34,8 @@ public function totals(): Totals $totalsContainer = $this->contextNode->appendChild( $this->dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'totals' - ) + 'totals', + ), ); } @@ -46,23 +46,23 @@ public function lineCoverage(string $line): Coverage { $coverage = $this->contextNode->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'coverage' + 'coverage', )->item(0); if (!$coverage) { $coverage = $this->contextNode->appendChild( $this->dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'coverage' - ) + 'coverage', + ), ); } $lineNode = $coverage->appendChild( $this->dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'line' - ) + 'line', + ), ); return new Coverage($lineNode, $line); diff --git a/src/Report/Xml/Node.php b/src/Report/Xml/Node.php index bd14c8d64..b2ba54b23 100644 --- a/src/Report/Xml/Node.php +++ b/src/Report/Xml/Node.php @@ -38,8 +38,8 @@ public function totals(): Totals $totalsContainer = $this->contextNode()->appendChild( $this->dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'totals' - ) + 'totals', + ), ); } @@ -50,7 +50,7 @@ public function addDirectory(string $name): Directory { $dirNode = $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'directory' + 'directory', ); $dirNode->setAttribute('name', $name); @@ -63,7 +63,7 @@ public function addFile(string $name, string $href): File { $fileNode = $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'file' + 'file', ); $fileNode->setAttribute('name', $name); diff --git a/src/Report/Xml/Project.php b/src/Report/Xml/Project.php index b566bce06..b450beb4f 100644 --- a/src/Report/Xml/Project.php +++ b/src/Report/Xml/Project.php @@ -31,15 +31,15 @@ public function buildInformation(): BuildInformation { $buildNode = $this->dom()->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'build' + 'build', )->item(0); if (!$buildNode) { $buildNode = $this->dom()->documentElement->appendChild( $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'build' - ) + 'build', + ), ); } @@ -50,15 +50,15 @@ public function tests(): Tests { $testsNode = $this->contextNode()->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'tests' + 'tests', )->item(0); if (!$testsNode) { $testsNode = $this->contextNode()->appendChild( $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'tests' - ) + 'tests', + ), ); } @@ -78,8 +78,8 @@ private function init(): void $this->setContextNode( $dom->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'project' - )->item(0) + 'project', + )->item(0), ); } diff --git a/src/Report/Xml/Report.php b/src/Report/Xml/Report.php index 7f2badaeb..09d103416 100644 --- a/src/Report/Xml/Report.php +++ b/src/Report/Xml/Report.php @@ -25,7 +25,7 @@ public function __construct(string $name) $contextNode = $dom->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'file' + 'file', )->item(0); parent::__construct($contextNode); @@ -43,8 +43,8 @@ public function functionObject($name): Method $node = $this->contextNode()->appendChild( $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'function' - ) + 'function', + ), ); return new Method($node, $name); @@ -64,15 +64,15 @@ public function source(): Source { $source = $this->contextNode()->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'source' + 'source', )->item(0); if (!$source) { $source = $this->contextNode()->appendChild( $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'source' - ) + 'source', + ), ); } @@ -90,8 +90,8 @@ private function unitObject(string $tagName, $name): Unit $node = $this->contextNode()->appendChild( $this->dom()->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - $tagName - ) + $tagName, + ), ); return new Unit($node, $name); diff --git a/src/Report/Xml/Source.php b/src/Report/Xml/Source.php index f6171f8ea..cd1fb90c5 100644 --- a/src/Report/Xml/Source.php +++ b/src/Report/Xml/Source.php @@ -35,7 +35,7 @@ public function setSourceCode(string $source): void $context->parentNode->replaceChild( $context->ownerDocument->importNode($srcDom->documentElement, true), - $context + $context, ); } } diff --git a/src/Report/Xml/Tests.php b/src/Report/Xml/Tests.php index e56df70e6..44d6010b8 100644 --- a/src/Report/Xml/Tests.php +++ b/src/Report/Xml/Tests.php @@ -33,8 +33,8 @@ public function addTest(string $test, array $result): void $node = $this->contextNode->appendChild( $this->contextNode->ownerDocument->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'test' - ) + 'test', + ), ); $node->setAttribute('name', $test); diff --git a/src/Report/Xml/Totals.php b/src/Report/Xml/Totals.php index d4f8f795a..239f6d43d 100644 --- a/src/Report/Xml/Totals.php +++ b/src/Report/Xml/Totals.php @@ -33,27 +33,27 @@ public function __construct(DOMElement $container) $this->linesNode = $dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'lines' + 'lines', ); $this->methodsNode = $dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'methods' + 'methods', ); $this->functionsNode = $dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'functions' + 'functions', ); $this->classesNode = $dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'classes' + 'classes', ); $this->traitsNode = $dom->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'traits' + 'traits', ); $container->appendChild($this->linesNode); @@ -77,7 +77,7 @@ public function setNumLines(int $loc, int $cloc, int $ncloc, int $executable, in $this->linesNode->setAttribute('executed', (string) $executed); $this->linesNode->setAttribute( 'percent', - $executable === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat()) + $executable === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat()), ); } @@ -87,7 +87,7 @@ public function setNumClasses(int $count, int $tested): void $this->classesNode->setAttribute('tested', (string) $tested); $this->classesNode->setAttribute( 'percent', - $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()) + $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()), ); } @@ -97,7 +97,7 @@ public function setNumTraits(int $count, int $tested): void $this->traitsNode->setAttribute('tested', (string) $tested); $this->traitsNode->setAttribute( 'percent', - $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()) + $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()), ); } @@ -107,7 +107,7 @@ public function setNumMethods(int $count, int $tested): void $this->methodsNode->setAttribute('tested', (string) $tested); $this->methodsNode->setAttribute( 'percent', - $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()) + $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()), ); } @@ -117,7 +117,7 @@ public function setNumFunctions(int $count, int $tested): void $this->functionsNode->setAttribute('tested', (string) $tested); $this->functionsNode->setAttribute( 'percent', - $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()) + $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()), ); } } diff --git a/src/Report/Xml/Unit.php b/src/Report/Xml/Unit.php index 2a4feb99a..ea1a47f24 100644 --- a/src/Report/Xml/Unit.php +++ b/src/Report/Xml/Unit.php @@ -41,15 +41,15 @@ public function setNamespace(string $namespace): void { $node = $this->contextNode->getElementsByTagNameNS( 'https://schema.phpunit.de/coverage/1.0', - 'namespace' + 'namespace', )->item(0); if (!$node) { $node = $this->contextNode->appendChild( $this->contextNode->ownerDocument->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'namespace' - ) + 'namespace', + ), ); } @@ -61,8 +61,8 @@ public function addMethod(string $name): Method $node = $this->contextNode->appendChild( $this->contextNode->ownerDocument->createElementNS( 'https://schema.phpunit.de/coverage/1.0', - 'method' - ) + 'method', + ), ); return new Method($node, $name); diff --git a/src/StaticAnalysis/CacheWarmer.php b/src/StaticAnalysis/CacheWarmer.php index 6f8a04494..47cc756c6 100644 --- a/src/StaticAnalysis/CacheWarmer.php +++ b/src/StaticAnalysis/CacheWarmer.php @@ -19,7 +19,7 @@ public function warmCache(string $cacheDirectory, bool $useAnnotationsForIgnorin $cacheDirectory, new ParsingFileAnalyser( $useAnnotationsForIgnoringCode, - $ignoreDeprecatedCode + $ignoreDeprecatedCode, ), $useAnnotationsForIgnoringCode, $ignoreDeprecatedCode, diff --git a/src/StaticAnalysis/CachingFileAnalyser.php b/src/StaticAnalysis/CachingFileAnalyser.php index 879f569ed..2ce4d604c 100644 --- a/src/StaticAnalysis/CachingFileAnalyser.php +++ b/src/StaticAnalysis/CachingFileAnalyser.php @@ -132,7 +132,7 @@ private function read(string $filename): array|false return unserialize( file_get_contents($cacheFile), - ['allowed_classes' => false] + ['allowed_classes' => false], ); } @@ -140,7 +140,7 @@ private function write(string $filename, array $data): void { file_put_contents( $this->cacheFile($filename), - serialize($data) + serialize($data), ); } @@ -155,8 +155,8 @@ private function cacheFile(string $filename): string self::cacheVersion(), $this->useAnnotationsForIgnoringCode, $this->ignoreDeprecatedCode, - ] - ) + ], + ), ); return $this->directory . DIRECTORY_SEPARATOR . $cacheKey; diff --git a/src/StaticAnalysis/CodeUnitFindingVisitor.php b/src/StaticAnalysis/CodeUnitFindingVisitor.php index 265c151e6..5530221dc 100644 --- a/src/StaticAnalysis/CodeUnitFindingVisitor.php +++ b/src/StaticAnalysis/CodeUnitFindingVisitor.php @@ -193,7 +193,7 @@ private function signature(ClassMethod|Function_ $node): string return $signature; } - private function type(Identifier|Name|ComplexType $type): string + private function type(ComplexType|Identifier|Name $type): string { if ($type instanceof NullableType) { return '?' . $type->type; diff --git a/src/StaticAnalysis/ExecutableLinesFindingVisitor.php b/src/StaticAnalysis/ExecutableLinesFindingVisitor.php index 8d6a5c256..f0e8d72b5 100644 --- a/src/StaticAnalysis/ExecutableLinesFindingVisitor.php +++ b/src/StaticAnalysis/ExecutableLinesFindingVisitor.php @@ -206,7 +206,7 @@ public function enterNode(Node $node): void if ($node instanceof Node\Expr\ArrowFunction) { $startLine = max( $node->getStartLine() + 1, - $node->expr->getStartLine() + $node->expr->getStartLine(), ); $endLine = $node->expr->getEndLine(); @@ -251,7 +251,7 @@ public function enterNode(Node $node): void $this->setLineBranch( $node->cond->getStartLine(), $node->cond->getStartLine(), - ++$this->nextBranch + ++$this->nextBranch, ); return; @@ -302,7 +302,7 @@ public function enterNode(Node $node): void $this->setLineBranch( $startLine, $endLine, - ++$this->nextBranch + ++$this->nextBranch, ); return; @@ -312,7 +312,7 @@ public function enterNode(Node $node): void $this->setLineBranch( $node->expr->getStartLine(), $node->valueVar->getEndLine(), - ++$this->nextBranch + ++$this->nextBranch, ); return; @@ -323,7 +323,7 @@ public function enterNode(Node $node): void $this->setLineBranch( $node->cond->getStartLine(), $node->cond->getEndLine(), - ++$this->nextBranch + ++$this->nextBranch, ); return; @@ -338,7 +338,7 @@ public function enterNode(Node $node): void $this->setLineBranch( $startLine, $endLine, - ++$this->nextBranch + ++$this->nextBranch, ); return; @@ -381,7 +381,7 @@ public function afterTraverse(array $nodes): void $this->executableLinesGroupedByBranch = array_diff_key( $this->executableLinesGroupedByBranch, - $this->unsets + $this->unsets, ); } diff --git a/src/StaticAnalysis/ParsingFileAnalyser.php b/src/StaticAnalysis/ParsingFileAnalyser.php index 3190bb4e1..ae2619fa7 100644 --- a/src/StaticAnalysis/ParsingFileAnalyser.php +++ b/src/StaticAnalysis/ParsingFileAnalyser.php @@ -167,10 +167,10 @@ private function analyse(string $filename): void sprintf( 'Cannot parse %s: %s', $filename, - $error->getMessage() + $error->getMessage(), ), $error->getCode(), - $error + $error, ); } // @codeCoverageIgnoreEnd @@ -186,8 +186,8 @@ private function analyse(string $filename): void $this->ignoredLines[$filename] = array_unique( array_merge( $this->ignoredLines[$filename], - $ignoredLinesFindingVisitor->ignoredLines() - ) + $ignoredLinesFindingVisitor->ignoredLines(), + ), ); sort($this->ignoredLines[$filename]); @@ -239,7 +239,7 @@ private function findLinesIgnoredByLineBasedAnnotations(string $filename, string $this->ignoredLines[$filename] = array_merge( $this->ignoredLines[$filename], - range($start, $token[2]) + range($start, $token[2]), ); } } diff --git a/src/Util/Filesystem.php b/src/Util/Filesystem.php index ff0e16ae9..0e99b1593 100644 --- a/src/Util/Filesystem.php +++ b/src/Util/Filesystem.php @@ -23,14 +23,14 @@ final class Filesystem */ public static function createDirectory(string $directory): void { - $success = !(!is_dir($directory) && !@mkdir($directory, 0777, true) && !is_dir($directory)); + $success = !(!is_dir($directory) && !@mkdir($directory, 0o777, true) && !is_dir($directory)); if (!$success) { throw new DirectoryCouldNotBeCreatedException( sprintf( 'Directory "%s" could not be created', - $directory - ) + $directory, + ), ); } } diff --git a/tests/tests/CodeCoverageTest.php b/tests/tests/CodeCoverageTest.php index 4a4ebe2f5..32f2f1de0 100644 --- a/tests/tests/CodeCoverageTest.php +++ b/tests/tests/CodeCoverageTest.php @@ -33,7 +33,7 @@ protected function setUp(): void $this->coverage = new CodeCoverage( (new Selector)->forLineCoverage($filter), - $filter + $filter, ); } @@ -43,7 +43,7 @@ public function testCollect(): void $this->assertEquals( $this->getExpectedLineCoverageDataArrayForBankAccount(), - $coverage->getData()->lineCoverage() + $coverage->getData()->lineCoverage(), ); $this->assertEquals( @@ -53,7 +53,7 @@ public function testCollect(): void 'BankAccountTest::testBalanceCannotBecomeNegative2' => ['size' => 'unknown', 'status' => 'unknown'], 'BankAccountTest::testDepositWithdrawMoney' => ['size' => 'unknown', 'status' => 'unknown'], ], - $coverage->getTests() + $coverage->getTests(), ); } @@ -111,7 +111,7 @@ public function testMerge(): void $this->assertEquals( $this->getExpectedLineCoverageDataArrayForBankAccount(), - $coverage->getData()->lineCoverage() + $coverage->getData()->lineCoverage(), ); } @@ -122,7 +122,7 @@ public function testMergeReverseOrder(): void $this->assertEquals( $this->getExpectedLineCoverageDataArrayForBankAccountInReverseOrder(), - $coverage->getData()->lineCoverage() + $coverage->getData()->lineCoverage(), ); } @@ -130,14 +130,14 @@ public function testMerge2(): void { $coverage = new CodeCoverage( $this->createStub(Driver::class), - new Filter + new Filter, ); $coverage->merge($this->getLineCoverageForBankAccount()); $this->assertEquals( $this->getExpectedLineCoverageDataArrayForBankAccount(), - $coverage->getData()->lineCoverage() + $coverage->getData()->lineCoverage(), ); } } diff --git a/tests/tests/Data/ProcessedCodeCoverageDataTest.php b/tests/tests/Data/ProcessedCodeCoverageDataTest.php index c2a9c68d6..46e144eec 100644 --- a/tests/tests/Data/ProcessedCodeCoverageDataTest.php +++ b/tests/tests/Data/ProcessedCodeCoverageDataTest.php @@ -21,7 +21,7 @@ public function testMergeWithLineCoverage(): void $this->assertEquals( $this->getExpectedLineCoverageDataArrayForBankAccount(), - $coverage->lineCoverage() + $coverage->lineCoverage(), ); } @@ -33,7 +33,7 @@ public function testMergeWithPathCoverage(): void $this->assertEquals( $this->getExpectedPathCoverageDataArrayForBankAccount(), - $coverage->functionCoverage() + $coverage->functionCoverage(), ); } @@ -45,7 +45,7 @@ public function testMergeWithPathCoverageIntoEmpty(): void $this->assertEquals( $this->getExpectedPathCoverageDataArrayForBankAccount(), - $coverage->functionCoverage() + $coverage->functionCoverage(), ); } @@ -59,7 +59,7 @@ public function testMergeOfAPreviouslyUnseenLine(): void 12 => [], 34 => null, ], - ] + ], ); $existingCoverage = new ProcessedCodeCoverageData; @@ -99,7 +99,7 @@ public function testMergeDoesNotCrashWhenFileContentsHaveChanged(): void ], ], ], - ] + ], ); $newCoverage = new ProcessedCodeCoverageData; @@ -170,7 +170,7 @@ public function testMergeDoesNotCrashWhenFileContentsHaveChanged(): void ], ], ], - ] + ], ); $coverage->merge($newCoverage); diff --git a/tests/tests/Data/RawCodeCoverageDataTest.php b/tests/tests/Data/RawCodeCoverageDataTest.php index d747232f5..b41e79376 100644 --- a/tests/tests/Data/RawCodeCoverageDataTest.php +++ b/tests/tests/Data/RawCodeCoverageDataTest.php @@ -316,7 +316,7 @@ public function testCoverageForFileWithInlineAnnotations(): void ], ], ], - ] + ], ); $coverage->removeCoverageDataForLines( @@ -326,7 +326,7 @@ public function testCoverageForFileWithInlineAnnotations(): void 31, 32, 33, - ] + ], ); $this->assertEquals( @@ -338,7 +338,7 @@ public function testCoverageForFileWithInlineAnnotations(): void 35 => -1, 36 => -1, ], - $coverage->lineCoverage()[$filename] + $coverage->lineCoverage()[$filename], ); $this->assertEquals( @@ -400,7 +400,7 @@ public function testCoverageForFileWithInlineAnnotations(): void ], ], ], - $coverage->functionCoverage()[$filename] + $coverage->functionCoverage()[$filename], ); } diff --git a/tests/tests/FilterTest.php b/tests/tests/FilterTest.php index 67f09f68e..490a2b3d9 100644 --- a/tests/tests/FilterTest.php +++ b/tests/tests/FilterTest.php @@ -40,7 +40,7 @@ public function testSingleFileCanBeAdded(): void [ $file, ], - $this->filter->files() + $this->filter->files(), ); } @@ -65,7 +65,7 @@ public function testDirectoryCanBeAdded(): void realpath(__DIR__ . '/../_files/filter/a.php'), realpath(__DIR__ . '/../_files/filter/b.php'), ], - $this->filter->files() + $this->filter->files(), ); } diff --git a/tests/tests/Node/BuilderTest.php b/tests/tests/Node/BuilderTest.php index fa5d81e06..3a0c9dfd9 100644 --- a/tests/tests/Node/BuilderTest.php +++ b/tests/tests/Node/BuilderTest.php @@ -95,8 +95,8 @@ public function testSomething(): void $this->assertEquals(0, $root->numberOfTestedFunctions()); $this->assertNull($root->parent()); $this->assertEquals([], $root->directories()); - #$this->assertEquals(array(), $root->getFiles()); - #$this->assertEquals(array(), $root->getChildNodes()); + # $this->assertEquals(array(), $root->getFiles()); + # $this->assertEquals(array(), $root->getChildNodes()); $this->assertEquals( [ @@ -186,7 +186,7 @@ public function testSomething(): void 'namespace' => '', ], ], - $root->classes() + $root->classes(), ); $this->assertEquals([], $root->functions()); @@ -198,7 +198,7 @@ public function testBuildDirectoryStructure(): void $method = new ReflectionMethod( Builder::class, - 'buildDirectoryStructure' + 'buildDirectoryStructure', ); $method->setAccessible(true); @@ -232,8 +232,8 @@ public function testBuildDirectoryStructure(): void "src{$s}Money.php" => [], "src{$s}MoneyBag.php" => [], "src{$s}Foo{$s}Bar{$s}Baz{$s}Foo.php" => [], - ]) - ) + ]), + ), ); } @@ -244,7 +244,7 @@ public function testReducePaths(array $reducedPaths, string $commonPath, Process { $method = new ReflectionMethod( Builder::class, - 'reducePaths' + 'reducePaths', ); $method->setAccessible(true); diff --git a/tests/tests/Report/CloverTest.php b/tests/tests/Report/CloverTest.php index d492191a1..434415772 100644 --- a/tests/tests/Report/CloverTest.php +++ b/tests/tests/Report/CloverTest.php @@ -21,7 +21,7 @@ public function testLineCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-clover-line.xml', - $clover->process($this->getLineCoverageForBankAccount(), null, 'BankAccount') + $clover->process($this->getLineCoverageForBankAccount(), null, 'BankAccount'), ); } @@ -31,7 +31,7 @@ public function testPathCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-clover-path.xml', - $clover->process($this->getPathCoverageForBankAccount(), null, 'BankAccount') + $clover->process($this->getPathCoverageForBankAccount(), null, 'BankAccount'), ); } @@ -41,7 +41,7 @@ public function testCloverForFileWithIgnoredLines(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'ignored-lines-clover.xml', - $clover->process($this->getCoverageForFileWithIgnoredLines()) + $clover->process($this->getCoverageForFileWithIgnoredLines()), ); } @@ -51,7 +51,7 @@ public function testCloverForClassWithAnonymousFunction(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'class-with-anonymous-function-clover.xml', - $clover->process($this->getCoverageForClassWithAnonymousFunction()) + $clover->process($this->getCoverageForClassWithAnonymousFunction()), ); } } diff --git a/tests/tests/Report/CoberturaTest.php b/tests/tests/Report/CoberturaTest.php index 2f6782a8f..2694bd1e4 100644 --- a/tests/tests/Report/CoberturaTest.php +++ b/tests/tests/Report/CoberturaTest.php @@ -21,7 +21,7 @@ public function testLineCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-cobertura-line.xml', - $cobertura->process($this->getLineCoverageForBankAccount(), null) + $cobertura->process($this->getLineCoverageForBankAccount(), null), ); } @@ -31,7 +31,7 @@ public function testPathCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-cobertura-path.xml', - $cobertura->process($this->getPathCoverageForBankAccount(), null) + $cobertura->process($this->getPathCoverageForBankAccount(), null), ); } @@ -41,7 +41,7 @@ public function testCoberturaForFileWithIgnoredLines(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'ignored-lines-cobertura.xml', - $cobertura->process($this->getCoverageForFileWithIgnoredLines()) + $cobertura->process($this->getCoverageForFileWithIgnoredLines()), ); } @@ -51,7 +51,7 @@ public function testCoberturaForClassWithAnonymousFunction(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'class-with-anonymous-function-cobertura.xml', - $cobertura->process($this->getCoverageForClassWithAnonymousFunction()) + $cobertura->process($this->getCoverageForClassWithAnonymousFunction()), ); } @@ -61,7 +61,7 @@ public function testCoberturaForClassAndOutsideFunction(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'class-with-outside-function-cobertura.xml', - $cobertura->process($this->getCoverageForClassWithOutsideFunction()) + $cobertura->process($this->getCoverageForClassWithOutsideFunction()), ); } } diff --git a/tests/tests/Report/Crap4jTest.php b/tests/tests/Report/Crap4jTest.php index ce428e0d8..72f029027 100644 --- a/tests/tests/Report/Crap4jTest.php +++ b/tests/tests/Report/Crap4jTest.php @@ -21,7 +21,7 @@ public function testForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-crap4j.xml', - $crap4j->process($this->getLineCoverageForBankAccount(), null, 'BankAccount') + $crap4j->process($this->getLineCoverageForBankAccount(), null, 'BankAccount'), ); } @@ -31,7 +31,7 @@ public function testForFileWithIgnoredLines(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'ignored-lines-crap4j.xml', - $crap4j->process($this->getCoverageForFileWithIgnoredLines(), null, 'CoverageForFileWithIgnoredLines') + $crap4j->process($this->getCoverageForFileWithIgnoredLines(), null, 'CoverageForFileWithIgnoredLines'), ); } @@ -41,7 +41,7 @@ public function testForClassWithAnonymousFunction(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'class-with-anonymous-function-crap4j.xml', - $crap4j->process($this->getCoverageForClassWithAnonymousFunction(), null, 'CoverageForClassWithAnonymousFunction') + $crap4j->process($this->getCoverageForClassWithAnonymousFunction(), null, 'CoverageForClassWithAnonymousFunction'), ); } } diff --git a/tests/tests/Report/Html/CustomCssFileTest.php b/tests/tests/Report/Html/CustomCssFileTest.php index 90dfe46a8..e2df312a4 100644 --- a/tests/tests/Report/Html/CustomCssFileTest.php +++ b/tests/tests/Report/Html/CustomCssFileTest.php @@ -25,7 +25,7 @@ public function testCanBeCreatedFromDefaults(): void $this->assertSame( realpath(__DIR__ . '/../../../../src/Report/Html/Renderer/Template/css/custom.css'), - realpath($file->path()) + realpath($file->path()), ); } diff --git a/tests/tests/Report/Html/EndToEndTest.php b/tests/tests/Report/Html/EndToEndTest.php index 27bde9615..419255df6 100644 --- a/tests/tests/Report/Html/EndToEndTest.php +++ b/tests/tests/Report/Html/EndToEndTest.php @@ -94,7 +94,7 @@ private function assertFilesEquals(string $expectedFilesPath, string $actualFile $this->assertEquals( iterator_count($expectedFilesIterator), iterator_count($actualFilesIterator), - 'Generated files and expected files not match' + 'Generated files and expected files not match', ); foreach ($expectedFilesIterator as $path => $fileInfo) { @@ -108,7 +108,7 @@ private function assertFilesEquals(string $expectedFilesPath, string $actualFile $this->assertStringMatchesFormatFile( $fileInfo->getPathname(), str_replace(PHP_EOL, "\n", file_get_contents($actualFile)), - "{$filename} not match" + "{$filename} not match", ); } } diff --git a/tests/tests/Report/TextTest.php b/tests/tests/Report/TextTest.php index 9194712d7..16a99d369 100644 --- a/tests/tests/Report/TextTest.php +++ b/tests/tests/Report/TextTest.php @@ -23,7 +23,7 @@ public function testLineCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-text-line.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForBankAccount())) + str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForBankAccount())), ); } @@ -33,7 +33,7 @@ public function testPathCoverageForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-text-path.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getPathCoverageForBankAccount())) + str_replace(PHP_EOL, "\n", $text->process($this->getPathCoverageForBankAccount())), ); } @@ -43,7 +43,7 @@ public function testTextOnlySummaryForBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccount-text-summary.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForBankAccount())) + str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForBankAccount())), ); } @@ -53,7 +53,7 @@ public function testTextForNamespacedBankAccountTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'NamespacedBankAccount-text.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForNamespacedBankAccount())) + str_replace(PHP_EOL, "\n", $text->process($this->getLineCoverageForNamespacedBankAccount())), ); } @@ -63,7 +63,7 @@ public function testTextForFileWithIgnoredLines(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'ignored-lines-text.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines())) + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines())), ); } @@ -73,7 +73,7 @@ public function testTextForClassWithAnonymousFunction(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'class-with-anonymous-function-text.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction())) + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction())), ); } @@ -83,7 +83,7 @@ public function testUncoveredFilesAreIncludedWhenConfiguredTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccountWithUncovered-text-line.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFilesWithUncoveredIncluded())) + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFilesWithUncoveredIncluded())), ); } @@ -93,7 +93,7 @@ public function testUncoveredFilesAreExcludedWhenConfiguredTest(): void $this->assertStringMatchesFormatFile( TEST_FILES_PATH . 'BankAccountWithoutUncovered-text-line.txt', - str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFilesWithUncoveredExcluded())) + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFilesWithUncoveredExcluded())), ); } } diff --git a/tests/tests/Report/XmlTest.php b/tests/tests/Report/XmlTest.php index f7e8f9b60..0ec8f2e40 100644 --- a/tests/tests/Report/XmlTest.php +++ b/tests/tests/Report/XmlTest.php @@ -75,7 +75,7 @@ private function assertFilesEquals(string $expectedFilesPath, string $actualFile $this->assertEquals( iterator_count($expectedFilesIterator), iterator_count($actualFilesIterator), - 'Generated files and expected files not match' + 'Generated files and expected files not match', ); foreach ($expectedFilesIterator as $path => $fileInfo) { @@ -89,7 +89,7 @@ private function assertFilesEquals(string $expectedFilesPath, string $actualFile $this->assertStringMatchesFormatFile( $fileInfo->getPathname(), file_get_contents($actualFile), - "{$filename} not match" + "{$filename} not match", ); } } diff --git a/tests/tests/StaticAnalysis/CodeUnitFindingVisitorTest.php b/tests/tests/StaticAnalysis/CodeUnitFindingVisitorTest.php index 0f1a8c77b..f9f34f794 100644 --- a/tests/tests/StaticAnalysis/CodeUnitFindingVisitorTest.php +++ b/tests/tests/StaticAnalysis/CodeUnitFindingVisitorTest.php @@ -94,7 +94,7 @@ public function testHandlesFunctionOrMethodWithUnionTypes(): void $this->assertSame( 'functionWithUnionTypes(string|bool $x): string|bool', - $functions['SebastianBergmann\CodeCoverage\TestFixture\functionWithUnionTypes']['signature'] + $functions['SebastianBergmann\CodeCoverage\TestFixture\functionWithUnionTypes']['signature'], ); } @@ -111,7 +111,7 @@ public function testHandlesFunctionOrMethodWithIntersectionTypes(): void $this->assertSame( 'functionWithIntersectionTypes(\SebastianBergmann\CodeCoverage\TestFixture\IntersectionPartOne&\SebastianBergmann\CodeCoverage\TestFixture\IntersectionPartTwo $x): \SebastianBergmann\CodeCoverage\TestFixture\IntersectionPartOne&\SebastianBergmann\CodeCoverage\TestFixture\IntersectionPartTwo', - $functions['SebastianBergmann\CodeCoverage\TestFixture\functionWithIntersectionTypes']['signature'] + $functions['SebastianBergmann\CodeCoverage\TestFixture\functionWithIntersectionTypes']['signature'], ); } @@ -128,24 +128,24 @@ public function testHandlesFunctionOrMethodWithDisjunctiveNormalFormTypes(): voi $this->assertSame( 'f((\SebastianBergmann\CodeCoverage\TestFixture\A&\SebastianBergmann\CodeCoverage\TestFixture\B)|\SebastianBergmann\CodeCoverage\TestFixture\D $x): void', - $functions['SebastianBergmann\CodeCoverage\TestFixture\f']['signature'] + $functions['SebastianBergmann\CodeCoverage\TestFixture\f']['signature'], ); $this->assertSame( 'g(\SebastianBergmann\CodeCoverage\TestFixture\C|(\SebastianBergmann\CodeCoverage\TestFixture\X&\SebastianBergmann\CodeCoverage\TestFixture\D)|null $x): void', - $functions['SebastianBergmann\CodeCoverage\TestFixture\g']['signature'] + $functions['SebastianBergmann\CodeCoverage\TestFixture\g']['signature'], ); $this->assertSame( 'h((\SebastianBergmann\CodeCoverage\TestFixture\A&\SebastianBergmann\CodeCoverage\TestFixture\B&\SebastianBergmann\CodeCoverage\TestFixture\D)|int|null $x): void', - $functions['SebastianBergmann\CodeCoverage\TestFixture\h']['signature'] + $functions['SebastianBergmann\CodeCoverage\TestFixture\h']['signature'], ); } private function findCodeUnits(string $filename): CodeUnitFindingVisitor { $nodes = (new ParserFactory)->createForHostVersion()->parse( - file_get_contents($filename) + file_get_contents($filename), ); assert($nodes !== null); diff --git a/tests/tests/StaticAnalysis/ExecutableLinesFindingVisitorTest.php b/tests/tests/StaticAnalysis/ExecutableLinesFindingVisitorTest.php index fcbd1075c..dd144b91d 100644 --- a/tests/tests/StaticAnalysis/ExecutableLinesFindingVisitorTest.php +++ b/tests/tests/StaticAnalysis/ExecutableLinesFindingVisitorTest.php @@ -74,7 +74,7 @@ private function doTestSelfDescribingAsset(string $filename): void $this->assertEquals( $expected, - $executableLinesGroupedByBranch + $executableLinesGroupedByBranch, ); } } diff --git a/tests/tests/StaticAnalysis/ParsingFileAnalyserTest.php b/tests/tests/StaticAnalysis/ParsingFileAnalyserTest.php index 5b3b03624..134a4866b 100644 --- a/tests/tests/StaticAnalysis/ParsingFileAnalyserTest.php +++ b/tests/tests/StaticAnalysis/ParsingFileAnalyserTest.php @@ -43,8 +43,8 @@ public function testGetLinesToBeIgnored(): void 42, ], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_ignore.php' - ) + TEST_FILES_PATH . 'source_with_ignore.php', + ), ); } @@ -53,8 +53,8 @@ public function testGetLinesToBeIgnored2(): void $this->assertEquals( [], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_without_ignore.php' - ) + TEST_FILES_PATH . 'source_without_ignore.php', + ), ); } @@ -65,8 +65,8 @@ public function testGetLinesToBeIgnored3(): void 3, ], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php' - ) + TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php', + ), ); } @@ -81,8 +81,8 @@ public function testLineWithFullyQualifiedClassNameConstantIsNotIgnored(): void 2, ], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_class_and_fqcn_constant.php' - ) + TEST_FILES_PATH . 'source_with_class_and_fqcn_constant.php', + ), ); } @@ -98,8 +98,8 @@ public function testGetLinesToBeIgnoredOneLineAnnotations(): void 33, ], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_oneline_annotations.php' - ) + TEST_FILES_PATH . 'source_with_oneline_annotations.php', + ), ); } @@ -112,8 +112,8 @@ public function testGetLinesToBeIgnoredWhenIgnoreIsDisabled(): void 33, ], (new ParsingFileAnalyser(false, false))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_ignore.php' - ) + TEST_FILES_PATH . 'source_with_ignore.php', + ), ); } @@ -122,8 +122,8 @@ public function testGetLinesOfCodeForFileWithoutNewline(): void $this->assertSame( 1, (new ParsingFileAnalyser(false, false))->linesOfCodeFor( - TEST_FILES_PATH . 'source_without_newline.php' - )['linesOfCode'] + TEST_FILES_PATH . 'source_without_newline.php', + )['linesOfCode'], ); } @@ -133,7 +133,7 @@ public function testGetLinesOfCodeForFileWithoutNewline(): void public function testGetLinesOfCodeForFileCrLineEndings(): void { $result = (new ParsingFileAnalyser(false, false))->linesOfCodeFor( - TEST_FILES_PATH . 'source_without_lf_only_cr.php' + TEST_FILES_PATH . 'source_without_lf_only_cr.php', ); $this->assertSame(4, $result['linesOfCode']); @@ -161,8 +161,8 @@ public function testLinesCanBeIgnoredUsingAttribute(): void 19, ], (new ParsingFileAnalyser(true, true))->ignoredLinesFor( - TEST_FILES_PATH . 'source_with_ignore_attributes.php' - ) + TEST_FILES_PATH . 'source_with_ignore_attributes.php', + ), ); } } diff --git a/tests/tests/Util/PercentageTest.php b/tests/tests/Util/PercentageTest.php index c794ff27a..6949532c3 100644 --- a/tests/tests/Util/PercentageTest.php +++ b/tests/tests/Util/PercentageTest.php @@ -19,7 +19,7 @@ public function testCanBeRepresentedAsFloat(): void { $this->assertSame( 50.0, - Percentage::fromFractionAndTotal(1, 2)->asFloat() + Percentage::fromFractionAndTotal(1, 2)->asFloat(), ); } @@ -27,7 +27,7 @@ public function testCanBeRepresentedAsString(): void { $this->assertSame( '50.00%', - Percentage::fromFractionAndTotal(1, 2)->asString() + Percentage::fromFractionAndTotal(1, 2)->asString(), ); } @@ -35,7 +35,7 @@ public function testCanBeRepresentedAsFixedWidthString(): void { $this->assertSame( ' 50.00%', - Percentage::fromFractionAndTotal(1, 2)->asFixedWidthString() + Percentage::fromFractionAndTotal(1, 2)->asFixedWidthString(), ); } @@ -43,12 +43,12 @@ public function testRepresentsTotalOfZeroAsEmptyString(): void { $this->assertSame( '', - Percentage::fromFractionAndTotal(0, 0)->asString() + Percentage::fromFractionAndTotal(0, 0)->asString(), ); $this->assertSame( '', - Percentage::fromFractionAndTotal(0, 0)->asFixedWidthString() + Percentage::fromFractionAndTotal(0, 0)->asFixedWidthString(), ); } @@ -56,7 +56,7 @@ public function testRepresentsTotalOfZeroAs100PercentFloat(): void { $this->assertSame( 100.0, - Percentage::fromFractionAndTotal(0, 0)->asFloat() + Percentage::fromFractionAndTotal(0, 0)->asFloat(), ); } }