File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
1919### Fixed
2020
2121* [ #866 ] ( https://github.com/sebastianbergmann/php-code-coverage/issues/866 ) : ` CodeUnitFindingVisitor ` does not handle ` enum ` type introduced in PHP 8.1
22+ * [ #868 ] ( https://github.com/sebastianbergmann/php-code-coverage/pull/868 ) : Uncovered files should be ignored unless requested
23+ * [ #876 ] ( https://github.com/sebastianbergmann/php-code-coverage/issues/876 ) : PCOV driver causes 2x slowdown after upgrade to PHPUnit 9.5
2224
2325## [ 9.2.7] - 2021-09-17
2426
Original file line number Diff line number Diff line change 99 */
1010namespace SebastianBergmann \CodeCoverage \Driver ;
1111
12+ use const pcov \inclusive ;
13+ use function array_intersect ;
1214use function extension_loaded ;
15+ use function pcov \clear ;
16+ use function pcov \collect ;
17+ use function pcov \start ;
18+ use function pcov \stop ;
19+ use function pcov \waiting ;
1320use function phpversion ;
1421use SebastianBergmann \CodeCoverage \Filter ;
1522use SebastianBergmann \CodeCoverage \RawCodeCoverageData ;
@@ -33,21 +40,27 @@ public function __construct(Filter $filter)
3340
3441 public function start (): void
3542 {
36- \ pcov \ start ();
43+ start ();
3744 }
3845
3946 public function stop (): RawCodeCoverageData
4047 {
41- \ pcov \ stop ();
48+ stop ();
4249
43- $ collect = \pcov \collect (
44- \pcov \inclusive,
45- !$ this ->filter ->isEmpty () ? $ this ->filter ->files () : \pcov \waiting ()
46- );
50+ $ filesToCollectCoverageFor = waiting ();
51+ $ collected = [];
4752
48- \pcov \clear ();
53+ if ($ filesToCollectCoverageFor ) {
54+ if (!$ this ->filter ->isEmpty ()) {
55+ $ filesToCollectCoverageFor = array_intersect ($ filesToCollectCoverageFor , $ this ->filter ->files ());
56+ }
4957
50- return RawCodeCoverageData::fromXdebugWithoutPathCoverage ($ collect );
58+ $ collected = collect (inclusive, $ filesToCollectCoverageFor );
59+
60+ clear ();
61+ }
62+
63+ return RawCodeCoverageData::fromXdebugWithoutPathCoverage ($ collected );
5164 }
5265
5366 public function nameAndVersion (): string
You can’t perform that action at this time.
0 commit comments