Skip to content

Commit fa6029f

Browse files
committed
small cs related fixes, add scoping to phar generation
1 parent aa08d42 commit fa6029f

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
/phpstan.neon export-ignore
1818
/phpstan-baseline.neon export-ignore
1919
/phpunit.xml export-ignore
20-
/renovate.json export-ignore
20+
/renovate.json export-ignore
21+
/scoper.inc.php export-ignore

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
PhpCsFixer\Finder::create()
114114
->in(__DIR__ . '/src')
115115
->in(__DIR__ . '/tests')
116+
->append([__DIR__ . '/scoper.inc.php'])
116117
)
117118
;
118119
$config->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
* `phpstan` to the non-dev `1.11.0`
2727
* `phpstan/phpstan-phpunit` to the non-dev `1.4.0`
2828
* `phpstan/phpstan-strict-rules` to the non-dev `1.6.0`
29+
* The `box` configuration for generating the Phar has been updated.
30+
* The Phar will now be scoped to `Esi\CoverageCheckPhar`.
31+
* The Phar now will be gz compressed.
32+
2933

3034
## [2.0.0] - 2024-04-21
3135

box.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"output": "bin/phpunit-coverage-check.phar",
33
"compactors": [
44
"KevinGH\\Box\\Compactor\\Php",
5-
"KevinGH\\Box\\Compactor\\Json"
5+
"KevinGH\\Box\\Compactor\\Json",
6+
"KevinGH\\Box\\Compactor\\PhpScoper"
67
],
8+
"compression": "GZ",
79
"banner": [
810
"This file is part of PHPUnit Coverage Check.",
911
"",

scoper.inc.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of PHPUnit Coverage Check.
7+
*
8+
* (c) Eric Sizemore <[email protected]>
9+
* (c) Richard Regeer <[email protected]>
10+
*
11+
* This source file is subject to the MIT license. For the full copyright,
12+
* license information, and credits/acknowledgements, please view the LICENSE
13+
* and README files that were distributed with this source code.
14+
*/
15+
return [
16+
'prefix' => 'Esi\CoverageCheckPhar',
17+
18+
'exclude-namespaces' => [
19+
'Esi\CoverageCheck',
20+
],
21+
];

src/CoverageCheck.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use RuntimeException;
2020
use SimpleXMLElement;
2121

22-
use function array_map;
22+
use function array_walk;
2323
use function file_get_contents;
2424
use function sprintf;
2525

@@ -134,7 +134,7 @@ public function process(): false|float
134134
//@codeCoverageIgnoreEnd
135135

136136
$metrics = ((array) $rawMetrics[0])['@attributes'];
137-
array_walk($metrics, static fn(string $value, string $key) => $metrics[$key] = intval($value));
137+
array_walk($metrics, static fn (string $value, string $key) => $metrics[$key] = \intval($value));
138138

139139
unset($rawMetrics);
140140

@@ -180,7 +180,7 @@ public function processByFile(): array|false
180180

181181
foreach ($rawMetrics as $file) {
182182
$metrics = ((array) $file->metrics)['@attributes'];
183-
array_walk($metrics, static fn(string $value, string $key) => $metrics[$key] = intval($value));
183+
array_walk($metrics, static fn (string $value, string $key) => $metrics[$key] = \intval($value));
184184

185185
$coveredMetrics = ($metrics['coveredconditionals'] + $metrics['coveredstatements'] + $metrics['coveredmethods']);
186186
$totalMetrics = ($metrics['conditionals'] + $metrics['statements'] + $metrics['methods']);

0 commit comments

Comments
 (0)