Skip to content

Commit 13203f2

Browse files
committed
chore(deps,maint): refresh lock file, CS fixes
1 parent ea94857 commit 13203f2

File tree

6 files changed

+28
-32
lines changed

6 files changed

+28
-32
lines changed

.php-cs-fixer.dist.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
'fully_qualified_strict_types' => true,
3939
'header_comment' => ['comment_type' => 'PHPDoc', 'header' => $header, 'separate' => 'top'],
4040
'heredoc_to_nowdoc' => true,
41-
//'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
42-
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
43-
'native_constant_invocation' => ['fix_built_in' => false, 'include' => ['DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID'], 'scope' => 'namespaced', 'strict' => true],
44-
'no_leading_import_slash' => true,
45-
'no_unneeded_import_alias' => true,
46-
'no_unused_imports' => true,
47-
'ordered_class_elements' => [
41+
//'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
42+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
43+
'native_constant_invocation' => ['fix_built_in' => false, 'include' => ['DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID'], 'scope' => 'namespaced', 'strict' => true],
44+
'no_leading_import_slash' => true,
45+
'no_unneeded_import_alias' => true,
46+
'no_unused_imports' => true,
47+
'ordered_class_elements' => [
4848
'order' => [
4949
'use_trait',
5050
'case',
@@ -102,11 +102,11 @@
102102
'phpdoc_var_without_name' => true,
103103
'php_unit_internal_class' => ['types' => ['normal', 'final']],
104104
'php_unit_expectation' => true,
105-
'single_import_per_statement' => true,
106-
'static_lambda' => true,
107-
'strict_param' => true,
108-
'use_arrow_functions' => true,
109-
'whitespace_after_comma_in_array' => true,
105+
'single_import_per_statement' => true,
106+
'static_lambda' => true,
107+
'strict_param' => true,
108+
'use_arrow_functions' => true,
109+
'whitespace_after_comma_in_array' => true,
110110
])
111111
->setLineEnding("\n")
112112
->setFinder(

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@
5454
"php": "^8.2 <8.5",
5555
"ext-libxml": "*",
5656
"ext-simplexml": "*",
57-
"symfony/console": "^7.0"
57+
"symfony/console": "^7.1"
5858
},
5959
"require-dev": {
60-
"friendsofphp/php-cs-fixer": "^3.58",
60+
"friendsofphp/php-cs-fixer": "^3.62",
6161
"phpstan/extension-installer": "^1.4",
6262
"phpstan/phpstan": "^1.11",
6363
"phpstan/phpstan-deprecation-rules": "^1.2",
6464
"phpstan/phpstan-phpunit": "^1.4",
6565
"phpstan/phpstan-strict-rules": "^1.6",
66-
"phpunit/phpunit": "^11.1"
66+
"phpunit/phpunit": "^11.3"
6767
},
6868
"minimum-stability": "dev",
6969
"prefer-stable": true,

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Command/CoverageCheckCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
use Symfony\Component\Console\Output\OutputInterface;
3131
use Throwable;
3232

33-
use function sprintf;
34-
3533
/**
3634
* @see \Esi\CoverageCheck\Tests\Command\CoverageCheckCommandTest
3735
*/
@@ -147,7 +145,7 @@ private function getFileTable(array $result): int
147145
foreach ($metrics as $name => $file) {
148146
$tableRows[] = [
149147
$name,
150-
sprintf('%d/%d', $file['coveredMetrics'], $file['totalMetrics']),
148+
\sprintf('%d/%d', $file['coveredMetrics'], $file['totalMetrics']),
151149
new TableCell(
152150
Utils::formatCoverage($file['percentage']),
153151
[
@@ -169,7 +167,7 @@ private function getFileTable(array $result): int
169167
$tableRows[] = new TableSeparator();
170168
$tableRows[] = [
171169
'Overall Totals',
172-
sprintf('%d/%d', $totalElements['coveredMetrics'], $totalElements['totalMetrics']),
170+
\sprintf('%d/%d', $totalElements['coveredMetrics'], $totalElements['totalMetrics']),
173171
new TableCell(
174172
Utils::formatCoverage($totalCoverage),
175173
['style' => new TableCellStyle(['cellFormat' => ($totalCoverage < $threshold) ? '<error>%s</error>' : '<info>%s</info>', ])]
@@ -216,14 +214,14 @@ private function getResultOutput(float $result): int
216214
if ($belowThreshold) {
217215
// ... below the accepted threshold
218216
$this->coverageCheckStyle->error(
219-
sprintf('Total code coverage is %s which is below the accepted %d%%', $formattedCoverage, $threshold)
217+
\sprintf('Total code coverage is %s which is below the accepted %d%%', $formattedCoverage, $threshold)
220218
);
221219

222220
return Command::FAILURE;
223221
}
224222

225223
// all good, we meet or exceed the threshold
226-
$this->coverageCheckStyle->success(sprintf('Total code coverage is %s', $formattedCoverage));
224+
$this->coverageCheckStyle->success(\sprintf('Total code coverage is %s', $formattedCoverage));
227225

228226
return Command::SUCCESS;
229227
}

src/CoverageCheck.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
use function array_walk;
2323
use function file_get_contents;
24-
use function sprintf;
2524

2625
/**
2726
* @see Command\CoverageCheckCommand
@@ -95,7 +94,7 @@ public function nonConsoleCall(string $cloverFile, int $threshold = 100, bool $o
9594
}
9695

9796
if ($results < $threshold && !$onlyPercentage) {
98-
return sprintf(
97+
return \sprintf(
9998
'[ERROR] Total code coverage is %s which is below the accepted %d%%',
10099
Utils::formatCoverage($results),
101100
$threshold
@@ -106,7 +105,7 @@ public function nonConsoleCall(string $cloverFile, int $threshold = 100, bool $o
106105
return Utils::formatCoverage($results);
107106
}
108107

109-
return sprintf('[OK] Total code coverage is %s', Utils::formatCoverage($results));
108+
return \sprintf('[OK] Total code coverage is %s', Utils::formatCoverage($results));
110109
}
111110

112111
/**
@@ -227,7 +226,7 @@ public function processByFile(): array|false
227226
public function setCloverFile(string $cloverFile): CoverageCheck
228227
{
229228
if (!Utils::validateCloverFile($cloverFile)) {
230-
throw new InvalidArgumentException(sprintf('Invalid input file provided. Was given: %s', $cloverFile));
229+
throw new InvalidArgumentException(\sprintf('Invalid input file provided. Was given: %s', $cloverFile));
231230
}
232231

233232
$this->cloverFile = $cloverFile;
@@ -248,7 +247,7 @@ public function setOnlyPercentage(bool $enable = false): CoverageCheck
248247
public function setThreshold(int $threshold): CoverageCheck
249248
{
250249
if (!Utils::validateThreshold($threshold)) {
251-
throw new InvalidArgumentException(sprintf('The threshold must be a minimum of 1 and a maximum of 100, %d given', $threshold));
250+
throw new InvalidArgumentException(\sprintf('The threshold must be a minimum of 1 and a maximum of 100, %d given', $threshold));
252251
}
253252

254253
$this->threshold = $threshold;
@@ -274,7 +273,7 @@ protected function loadMetrics(string $xpath = self::XPATH_METRICS): null|array|
274273

275274
//@codeCoverageIgnoreStart
276275
if ($cloverData === false || $cloverData === '') {
277-
throw new RuntimeException(sprintf('Failed to get the contents of %s', $this->cloverFile));
276+
throw new RuntimeException(\sprintf('Failed to get the contents of %s', $this->cloverFile));
278277
}
279278
//@codeCoverageIgnoreEnd
280279

src/Utils.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use function libxml_get_errors;
2525
use function libxml_use_internal_errors;
2626
use function property_exists;
27-
use function sprintf;
2827
use function trim;
2928

3029
use const LIBXML_ERR_ERROR;
@@ -39,7 +38,7 @@ final class Utils
3938
*/
4039
public static function formatCoverage(float $number): string
4140
{
42-
return sprintf('%0.2F%%', $number);
41+
return \sprintf('%0.2F%%', $number);
4342
}
4443

4544
/**
@@ -102,7 +101,7 @@ public static function parseXml(string $xmlData): SimpleXMLElement
102101
$errorMessage = PHP_EOL;
103102

104103
foreach (libxml_get_errors() as $error) {
105-
$errorMessage .= sprintf(
104+
$errorMessage .= \sprintf(
106105
'%s %d: %s. Line %d Column %d',
107106
$errorLevels[$error->level],
108107
$error->code,
@@ -112,7 +111,7 @@ public static function parseXml(string $xmlData): SimpleXMLElement
112111
) . PHP_EOL;
113112
}
114113

115-
throw new RuntimeException(sprintf('Unable to load Clover XML data. LibXml returned: %s', $errorMessage));
114+
throw new RuntimeException(\sprintf('Unable to load Clover XML data. LibXml returned: %s', $errorMessage));
116115
} finally {
117116
libxml_clear_errors();
118117
libxml_use_internal_errors(false);

0 commit comments

Comments
 (0)