1 | <?php |
||||
2 | use Kahlan\Filter\Filters; |
||||
3 | use Kahlan\Reporter\Coverage; |
||||
4 | use Kahlan\Reporter\Coverage\Driver\Xdebug; |
||||
5 | use Kahlan\Reporter\Coverage\Driver\Phpdbg; |
||||
6 | use Kahlan\Reporter\Coverage\Exporter\Clover; |
||||
7 | |||||
8 | $commandLine = $this->commandLine(); |
||||
9 | $commandLine->option('ff', 'default', 1); |
||||
10 | $commandLine->option('coverage-scrutinizer', 'default', 'scrutinizer.xml'); |
||||
11 | |||||
12 | Filters::apply($this, 'reporting', function($next) { |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
13 | |||||
14 | // Get the reporter called `'coverage'` from the list of reporters |
||||
15 | $reporter = $this->reporters()->get('coverage'); |
||||
16 | |||||
17 | // Abort if no coverage is available. |
||||
18 | if (!$reporter || !$this->commandLine()->exists('coverage-scrutinizer')) { |
||||
19 | return $next(); |
||||
20 | } |
||||
21 | |||||
22 | Clover::write([ |
||||
23 | 'collector' => $reporter, |
||||
24 | 'file' => $this->commandLine()->get('coverage-scrutinizer'), |
||||
25 | ]); |
||||
26 | |||||
27 | return $next(); |
||||
28 | }); |
||||
29 | |||||
30 | Filters::apply($this, 'coverage', function($next) { |
||||
0 ignored issues
–
show
function(...) { /* ... */ } of type callable is incompatible with the type string expected by parameter $filter of Kahlan\Filter\Filters::apply() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
31 | if (!extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') { |
||||
32 | return; |
||||
33 | } |
||||
34 | $reporters = $this->reporters(); |
||||
35 | $coverage = new Coverage([ |
||||
36 | 'verbosity' => $this->commandLine()->get('coverage'), |
||||
37 | 'driver' => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(), |
||||
38 | 'path' => $this->commandLine()->get('src'), |
||||
39 | 'colors' => !$this->commandLine()->get('no-colors') |
||||
40 | ]); |
||||
41 | $reporters->add('coverage', $coverage); |
||||
42 | }); |
||||
43 |