Skip to content

Commit fb1e9af

Browse files
Initial work on #126
1 parent 47e3851 commit fb1e9af

File tree

11 files changed

+121
-125
lines changed

11 files changed

+121
-125
lines changed

.psalm/baseline.xml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.x-dev@">
2+
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
33
<file src="src/PatchCoverage.php">
4-
<UnresolvableInclude occurrences="1">
5-
<code>include($coverageFile)</code>
4+
<UnresolvableInclude>
5+
<code>include $coverageFile</code>
66
</UnresolvableInclude>
77
</file>
88
<file src="src/cli/Application.php">
9-
<InvalidCatch occurrences="1"/>
9+
<InvalidCatch>
10+
<code>try {
11+
$arguments = (new ArgumentsBuilder)-&gt;build($argv);
12+
} catch (Exception $e) {
13+
print PHP_EOL . $e-&gt;getMessage() . PHP_EOL;
14+
15+
return 1;
16+
}</code>
17+
</InvalidCatch>
1018
</file>
11-
<file src="src/cli/Arguments.php">
12-
<UndefinedThisPropertyAssignment occurrences="1">
13-
<code>$this-&gt;cobertura</code>
14-
</UndefinedThisPropertyAssignment>
15-
<UndefinedThisPropertyFetch occurrences="1">
16-
<code>$this-&gt;cobertura</code>
17-
</UndefinedThisPropertyFetch>
19+
<file src="src/cli/ArgumentsBuilder.php">
20+
<ArgumentTypeCoercion>
21+
<code>$argv</code>
22+
</ArgumentTypeCoercion>
1823
</file>
1924
<file src="src/cli/Command.php">
20-
<InternalClass occurrences="2">
21-
<code>new FilterMapper</code>
25+
<InternalClass>
26+
<code>new CliConfigurationBuilder</code>
2227
<code>new Loader</code>
28+
<code>new Merger</code>
2329
</InternalClass>
24-
<InternalMethod occurrences="7">
25-
<code>codeCoverage</code>
26-
<code>codeCoverage</code>
27-
<code>codeCoverage</code>
28-
<code>includeUncoveredFiles</code>
30+
<InternalMethod>
31+
<code>fromParameters</code>
2932
<code>load</code>
30-
<code>map</code>
31-
<code>processUncoveredFiles</code>
33+
<code>merge</code>
3234
</InternalMethod>
3335
</file>
3436
<file src="src/cli/ExecuteCommand.php">
35-
<DeprecatedMethod occurrences="2">
36-
<code>Driver::forLineAndPathCoverage($filter)</code>
37-
<code>Driver::forLineCoverage($filter)</code>
38-
</DeprecatedMethod>
39-
<PossiblyNullArgument occurrences="2">
37+
<PossiblyNullArgument>
4038
<code>$arguments-&gt;script()</code>
4139
<code>$arguments-&gt;script()</code>
4240
</PossiblyNullArgument>
4341
</file>
4442
<file src="src/cli/MergeCommand.php">
45-
<PossiblyNullArgument occurrences="4">
43+
<PossiblyNullArgument>
4644
<code>$arguments-&gt;directory()</code>
4745
<code>$arguments-&gt;directory()</code>
4846
<code>$arguments-&gt;directory()</code>
4947
<code>$arguments-&gt;directory()</code>
5048
</PossiblyNullArgument>
51-
<UnresolvableInclude occurrences="1">
52-
<code>include($file)</code>
49+
<UnresolvableInclude>
50+
<code>include $file</code>
5351
</UnresolvableInclude>
5452
</file>
5553
<file src="src/cli/PatchCoverageCommand.php">
56-
<PossiblyNullArgument occurrences="6">
54+
<PossiblyNullArgument>
5755
<code>$arguments-&gt;coverage()</code>
5856
<code>$arguments-&gt;coverage()</code>
5957
<code>$arguments-&gt;coverage()</code>

ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes in PHPCOV are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [9.0.0] - 2023-MM-DD
6+
7+
### Removed
8+
9+
* PHP 7.3, PHP 7.4, and PHP 8.0 are no longer supported
10+
511
## [8.2.1] - 2022-03-24
612

713
* No changes; `phpcov.phar` rebuilt with updated dependencies
@@ -74,6 +80,7 @@ All notable changes in PHPCOV are documented in this file using the [Keep a CHAN
7480

7581
* Removed support for PHP versions older than PHP 7.2
7682

83+
[9.0.0]: https://github.com/sebastianbergmann/phpcov/compare/8.2.1...main
7784
[8.2.1]: https://github.com/sebastianbergmann/phpcov/compare/8.2.0...8.2.1
7885
[8.2.0]: https://github.com/sebastianbergmann/phpcov/compare/8.1.2...8.2.0
7986
[8.1.2]: https://github.com/sebastianbergmann/phpcov/compare/8.1.1...8.1.2

composer.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@
1515
},
1616
"config": {
1717
"platform": {
18-
"php": "7.3.0"
18+
"php": "8.1.0"
1919
},
2020
"optimize-autoloader": true,
2121
"sort-packages": true
2222
},
2323
"prefer-stable": true,
24+
"minimum-stability": "dev",
2425
"require": {
25-
"php": ">=7.3",
26-
"phpunit/phpunit": "^9.3",
27-
"phpunit/php-code-coverage": "^9.2",
28-
"phpunit/php-file-iterator": "^3.0",
29-
"sebastian/cli-parser": "^1.0",
30-
"sebastian/diff": "^4.0",
31-
"sebastian/version": "^3.0"
26+
"php": ">=8.1",
27+
"phpunit/phpunit": "^10.0",
28+
"phpunit/php-code-coverage": "^10.0",
29+
"phpunit/php-file-iterator": "^4.0",
30+
"sebastian/cli-parser": "^2.0",
31+
"sebastian/diff": "^5.0",
32+
"sebastian/version": "^4.0"
3233
},
3334
"autoload": {
3435
"classmap": [
@@ -40,7 +41,7 @@
4041
],
4142
"extra": {
4243
"branch-alias": {
43-
"dev-main": "8.2-dev"
44+
"dev-main": "9.0-dev"
4445
}
4546
}
4647
}

phpunit.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
cacheResultFile=".phpunit.cache/test-results"
5+
cacheDirectory=".phpunit.cache"
66
executionOrder="depends,defects"
7-
forceCoversAnnotation="true"
8-
beStrictAboutCoversAnnotation="true"
7+
requireCoverageMetadata="true"
8+
beStrictAboutCoverageMetadata="true"
99
beStrictAboutOutputDuringTests="true"
10-
beStrictAboutTodoAnnotatedTests="true"
11-
convertDeprecationsToExceptions="true"
1210
failOnRisky="true"
1311
failOnWarning="true"
14-
colors="true"
15-
verbose="true">
12+
colors="true">
1613
<testsuites>
1714
<testsuite name="end-to-end">
1815
<directory suffix=".phpt">tests/end-to-end</directory>
1916
</testsuite>
2017
</testsuites>
2118

22-
<coverage cacheDirectory=".phpunit.cache/code-coverage"
23-
processUncoveredFiles="true">
19+
<coverage>
2420
<include>
2521
<directory suffix=".php">src</directory>
2622
</include>

src/cli/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
final class Application
1717
{
18-
private const VERSION = '8.2.1';
18+
private const VERSION = '9.0';
1919

2020
public function run(array $argv): int
2121
{
@@ -60,7 +60,7 @@ private function printVersion(): void
6060
{
6161
printf(
6262
'phpcov %s by Sebastian Bergmann.' . PHP_EOL,
63-
(new Version(self::VERSION, dirname(__DIR__)))->getVersion()
63+
(new Version(self::VERSION, dirname(__DIR__)))->asString()
6464
);
6565
}
6666
}

src/cli/Arguments.php

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ final class Arguments
5656
*/
5757
private $addUncovered;
5858

59-
/**
60-
* @var bool
61-
*/
62-
private $processUncovered;
63-
6459
/**
6560
* @var ?string
6661
*/
@@ -111,28 +106,27 @@ final class Arguments
111106
*/
112107
private $pathPrefix;
113108

114-
public function __construct(?string $command, ?string $script, ?string $directory, ?string $coverage, ?string $patch, ?string $configuration, array $include, bool $pathCoverage, bool $addUncovered, bool $processUncovered, ?string $clover, ?string $cobertura, ?string $crap4j, ?string $html, ?string $php, ?string $text, ?string $xml, ?string $pathPrefix, bool $help, bool $version)
115-
{
116-
$this->command = $command;
117-
$this->script = $script;
118-
$this->directory = $directory;
119-
$this->coverage = $coverage;
120-
$this->patch = $patch;
121-
$this->configuration = $configuration;
122-
$this->include = $include;
123-
$this->pathCoverage = $pathCoverage;
124-
$this->addUncovered = $addUncovered;
125-
$this->processUncovered = $processUncovered;
126-
$this->clover = $clover;
127-
$this->cobertura = $cobertura;
128-
$this->crap4j = $crap4j;
129-
$this->html = $html;
130-
$this->php = $php;
131-
$this->text = $text;
132-
$this->xml = $xml;
133-
$this->pathPrefix = $pathPrefix;
134-
$this->help = $help;
135-
$this->version = $version;
109+
public function __construct(?string $command, ?string $script, ?string $directory, ?string $coverage, ?string $patch, ?string $configuration, array $include, bool $pathCoverage, bool $addUncovered, ?string $clover, ?string $cobertura, ?string $crap4j, ?string $html, ?string $php, ?string $text, ?string $xml, ?string $pathPrefix, bool $help, bool $version)
110+
{
111+
$this->command = $command;
112+
$this->script = $script;
113+
$this->directory = $directory;
114+
$this->coverage = $coverage;
115+
$this->patch = $patch;
116+
$this->configuration = $configuration;
117+
$this->include = $include;
118+
$this->pathCoverage = $pathCoverage;
119+
$this->addUncovered = $addUncovered;
120+
$this->clover = $clover;
121+
$this->cobertura = $cobertura;
122+
$this->crap4j = $crap4j;
123+
$this->html = $html;
124+
$this->php = $php;
125+
$this->text = $text;
126+
$this->xml = $xml;
127+
$this->pathPrefix = $pathPrefix;
128+
$this->help = $help;
129+
$this->version = $version;
136130
}
137131

138132
public function command(): ?string
@@ -180,11 +174,6 @@ public function addUncovered(): bool
180174
return $this->addUncovered;
181175
}
182176

183-
public function processUncovered(): bool
184-
{
185-
return $this->processUncovered;
186-
}
187-
188177
public function clover(): ?string
189178
{
190179
return $this->clover;

src/cli/ArgumentsBuilder.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ final class ArgumentsBuilder
2121
'configuration=',
2222
'include=',
2323
'add-uncovered',
24-
'process-uncovered',
2524
'path-coverage',
2625
'clover=',
2726
'cobertura=',
@@ -88,7 +87,7 @@ public function build(array $argv): Arguments
8887
} catch (CliParserException $e) {
8988
throw new ArgumentsBuilderException(
9089
$e->getMessage(),
91-
(int) $e->getCode(),
90+
$e->getCode(),
9291
$e
9392
);
9493
}
@@ -124,21 +123,20 @@ public function build(array $argv): Arguments
124123
break;
125124
}
126125

127-
$configuration = null;
128-
$include = [];
129-
$pathCoverage = false;
130-
$addUncovered = false;
131-
$processUncovered = false;
132-
$clover = null;
133-
$cobertura = null;
134-
$crap4j = null;
135-
$html = null;
136-
$php = null;
137-
$text = null;
138-
$xml = null;
139-
$pathPrefix = null;
140-
$help = false;
141-
$version = false;
126+
$configuration = null;
127+
$include = [];
128+
$pathCoverage = false;
129+
$addUncovered = false;
130+
$clover = null;
131+
$cobertura = null;
132+
$crap4j = null;
133+
$html = null;
134+
$php = null;
135+
$text = null;
136+
$xml = null;
137+
$pathPrefix = null;
138+
$help = false;
139+
$version = false;
142140

143141
foreach ($options[0] as $option) {
144142
switch ($option[0]) {
@@ -162,11 +160,6 @@ public function build(array $argv): Arguments
162160

163161
break;
164162

165-
case '--process-uncovered':
166-
$processUncovered = true;
167-
168-
break;
169-
170163
case '--clover':
171164
$clover = $option[1];
172165

@@ -231,7 +224,6 @@ public function build(array $argv): Arguments
231224
$include,
232225
$pathCoverage,
233226
$addUncovered,
234-
$processUncovered,
235227
$clover,
236228
$cobertura,
237229
$crap4j,

0 commit comments

Comments
 (0)