Skip to content

Commit 52f5578

Browse files
Closes #834
1 parent e081634 commit 52f5578

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

ChangeLog.md

+7
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+
## [7.0.12] - 2020-11-27
6+
7+
### Added
8+
9+
* [#834](https://github.com/sebastianbergmann/php-code-coverage/issues/834): Support `XDEBUG_MODE` environment variable
10+
511
## [7.0.11] - 2020-11-27
612

713
### Added
@@ -118,6 +124,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
118124
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
119125
* Update HTML report to Bootstrap 4
120126

127+
[7.0.12]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.11...7.0.12
121128
[7.0.11]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.10...7.0.11
122129
[7.0.10]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.9...7.0.10
123130
[7.0.9]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.8...7.0.9

src/Driver/Xdebug.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ public function __construct(Filter $filter = null)
3838
throw new RuntimeException('This driver requires Xdebug');
3939
}
4040

41-
if (\version_compare(\phpversion('xdebug'), '3', '>=') &&
42-
!\ini_get('xdebug.mode') || !\in_array('coverage', \explode(',', \ini_get('xdebug.mode')), true)) {
43-
throw new RuntimeException('xdebug.mode=coverage has to be set in php.ini');
44-
}
41+
if (\version_compare(\phpversion('xdebug'), '3', '>=')) {
42+
$mode = \getenv('XDEBUG_MODE');
43+
44+
if ($mode === false) {
45+
$mode = \ini_get('xdebug.mode');
46+
}
4547

46-
if (\version_compare(\phpversion('xdebug'), '3', '<') &&
47-
!\ini_get('xdebug.coverage_enable')) {
48-
throw new RuntimeException('xdebug.coverage_enable=On has to be set in php.ini');
48+
if ($mode === false ||
49+
!\in_array('coverage', \explode(',', $mode), true)) {
50+
throw new RuntimeException('XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set');
51+
}
52+
} elseif (!\ini_get('xdebug.coverage_enable')) {
53+
throw new RuntimeException('xdebug.coverage_enable=On has to be set');
4954
}
5055

5156
if ($filter === null) {

src/Version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class Version
2121
public static function id(): string
2222
{
2323
if (self::$version === null) {
24-
$version = new VersionId('7.0.11', \dirname(__DIR__));
24+
$version = new VersionId('7.0.12', \dirname(__DIR__));
2525
self::$version = $version->getVersion();
2626
}
2727

0 commit comments

Comments
 (0)