Skip to content

Commit 0a7f0ac

Browse files
Closes #834
1 parent 1119aa8 commit 0a7f0ac

5 files changed

+20
-4
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+
## [9.2.4] - 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
## [9.2.3] - 2020-10-30
612

713
### Changed
@@ -306,6 +312,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
306312
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
307313
* Update HTML report to Bootstrap 4
308314

315+
[9.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.3...9.2.4
309316
[9.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.2...9.2.3
310317
[9.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.1...9.2.2
311318
[9.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.0...9.2.1

src/Driver/Xdebug3Driver.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
use const XDEBUG_CC_UNUSED;
1515
use const XDEBUG_FILTER_CODE_COVERAGE;
1616
use const XDEBUG_PATH_INCLUDE;
17+
use function explode;
1718
use function extension_loaded;
19+
use function getenv;
1820
use function in_array;
1921
use function ini_get;
2022
use function phpversion;
@@ -52,7 +54,14 @@ public function __construct(Filter $filter)
5254
);
5355
}
5456

55-
if (!ini_get('xdebug.mode') || !in_array('coverage', explode(',', ini_get('xdebug.mode')), true)) {
57+
$mode = getenv('XDEBUG_MODE');
58+
59+
if ($mode === false) {
60+
$mode = ini_get('xdebug.mode');
61+
}
62+
63+
if ($mode === false ||
64+
!in_array('coverage', explode(',', $mode), true)) {
5665
throw new Xdebug3NotEnabledException;
5766
}
5867

src/Exception/Xdebug2NotEnabledException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ final class Xdebug2NotEnabledException extends RuntimeException implements Excep
1616
{
1717
public function __construct()
1818
{
19-
parent::__construct('xdebug.coverage_enable=On has to be set in php.ini');
19+
parent::__construct('xdebug.coverage_enable=On has to be set');
2020
}
2121
}

src/Exception/Xdebug3NotEnabledException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ final class Xdebug3NotEnabledException extends RuntimeException implements Excep
1616
{
1717
public function __construct()
1818
{
19-
parent::__construct('xdebug.mode=coverage has to be set in php.ini');
19+
parent::__construct('XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set');
2020
}
2121
}

src/Version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class Version
2222
public static function id(): string
2323
{
2424
if (self::$version === null) {
25-
self::$version = (new VersionId('9.2.3', dirname(__DIR__)))->getVersion();
25+
self::$version = (new VersionId('9.2.4', dirname(__DIR__)))->getVersion();
2626
}
2727

2828
return self::$version;

0 commit comments

Comments
 (0)