Skip to content

Commit b430851

Browse files
Use XDEBUG_CC_BRANCH_CHECK flag when available
1 parent 508f1d1 commit b430851

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/CodeCoverage/Driver/Xdebug.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323
class PHP_CodeCoverage_Driver_Xdebug implements PHP_CodeCoverage_Driver
2424
{
25+
/**
26+
* @var integer
27+
*/
28+
private $flags;
29+
2530
/**
2631
* Constructor.
2732
*/
@@ -37,14 +42,20 @@ public function __construct()
3742
'xdebug.coverage_enable=On has to be set in php.ini'
3843
);
3944
}
45+
46+
$this->flags = XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE;
47+
48+
if (defined('XDEBUG_CC_BRANCH_CHECK')) {
49+
$this->flags |= XDEBUG_CC_BRANCH_CHECK;
50+
}
4051
}
4152

4253
/**
4354
* Start collection of code coverage information.
4455
*/
4556
public function start()
4657
{
47-
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
58+
xdebug_start_code_coverage($this->flags);
4859
}
4960

5061
/**

0 commit comments

Comments
 (0)