Skip to content

Commit 8765f64

Browse files
Use __serialize() instead of __sleep()
1 parent da2cdaf commit 8765f64

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

ChangeLog-12.3.md

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

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

5+
## [12.3.7] - 2025-MM-DD
6+
7+
### Changed
8+
9+
* Do not use `__sleep()` method (which will be deprecated in PHP 8.5)
10+
511
## [12.3.6] - 2025-09-02
612

713
### Fixed
@@ -50,6 +56,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
5056

5157
* [#1080](https://github.com/sebastianbergmann/php-code-coverage/pull/1080): Support for reporting code coverage information in OpenClover XML format; unlike the existing Clover XML reporter, which remains unchanged, the XML documents generated by this new reporter validate against the OpenClover project's XML schema definition, with one exception: we do not generate the `<testproject>` element. This feature is experimental and the generated XML might change in order to improve compliance with the OpenClover project's XML schema definition further. Such changes will be made in bugfix and/or minor releases even if they break backward compatibility.
5258

59+
[12.3.7]: https://github.com/sebastianbergmann/php-code-coverage/compare/12.3.6...main
5360
[12.3.6]: https://github.com/sebastianbergmann/php-code-coverage/compare/12.3.5...12.3.6
5461
[12.3.5]: https://github.com/sebastianbergmann/php-code-coverage/compare/12.3.4...12.3.5
5562
[12.3.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/12.3.3...12.3.4

src/CodeCoverage.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,34 @@ public function __construct(Driver $driver, Filter $filter)
7878
}
7979

8080
/**
81-
* @return non-empty-list<non-empty-string>
81+
* @return array{
82+
* cacheDirectory: ?string,
83+
* checkForUnintentionallyCoveredCode: bool,
84+
* includeUncoveredFiles: bool,
85+
* ignoreDeprecatedCode: bool,
86+
* parentClassesExcludedFromUnintentionallyCoveredCodeCheck: list<class-string>,
87+
* filter: Filter,
88+
* data: ProcessedCodeCoverageData,
89+
* tests: array<string, TestType>
90+
* }
8291
*/
83-
public function __sleep(): array
92+
public function __serialize(): array
8493
{
94+
$prefix = "\x00" . self::class . "\x00";
95+
8596
return [
8697
// Configuration
87-
'cacheDirectory',
88-
'checkForUnintentionallyCoveredCode',
89-
'includeUncoveredFiles',
90-
'ignoreDeprecatedCode',
91-
'parentClassesExcludedFromUnintentionallyCoveredCodeCheck',
92-
'useAnnotationsForIgnoringCode',
93-
'filter',
98+
$prefix . 'cacheDirectory' => $this->cacheDirectory,
99+
$prefix . 'checkForUnintentionallyCoveredCode' => $this->checkForUnintentionallyCoveredCode,
100+
$prefix . 'includeUncoveredFiles' => $this->includeUncoveredFiles,
101+
$prefix . 'ignoreDeprecatedCode' => $this->ignoreDeprecatedCode,
102+
$prefix . 'parentClassesExcludedFromUnintentionallyCoveredCodeCheck' => $this->parentClassesExcludedFromUnintentionallyCoveredCodeCheck,
103+
$prefix . 'useAnnotationsForIgnoringCode' => $this->useAnnotationsForIgnoringCode,
104+
$prefix . 'filter' => $this->filter,
94105

95106
// Data
96-
'data',
97-
'tests',
107+
$prefix . 'data' => $this->data,
108+
$prefix . 'tests' => $this->tests,
98109
];
99110
}
100111

0 commit comments

Comments
 (0)