Issues (14)

kahlan-config.php (5 issues)

1
<?php
2
3
use Kahlan\Filter\Filters;
4
use Kahlan\Reporter\Coverage;
5
use Kahlan\Reporter\Coverage\Driver\Phpdbg;
6
use Kahlan\Reporter\Coverage\Driver\Xdebug;
7
use Kahlan\Reporter\Coverage\Exporter\Clover;
8
9
$commandLine = $this->commandLine();
10
$commandLine->option('ff', 'default', 1);
11
$commandLine->option('coverage-scrutinizer', 'default', 'scrutinizer.xml');
12
13
Filters::apply($this, 'reporting', 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 ignore-type  annotation

13
Filters::apply($this, 'reporting', /** @scrutinizer ignore-type */ function ($next) {
Loading history...
14
15
    // Get the reporter called `'coverage'` from the list of reporters
16
    $reporter = $this->reporters()->get('coverage');
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
17
18
    // Abort if no coverage is available.
19
    if (! $reporter || ! $this->commandLine()->exists('coverage-scrutinizer')) {
20
        return $next();
21
    }
22
23
    // Use the `Coveralls` class to write the JSON coverage into a file
24
    Clover::write([
25
        'collector' => $reporter,
26
        'file' => $this->commandLine()->get('coverage-scrutinizer'),
27
    ]);
28
29
    return $next();
30
});
31
32
Filters::apply($this, 'coverage', function ($next) {
0 ignored issues
show
The parameter $next is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

32
Filters::apply($this, 'coverage', function (/** @scrutinizer ignore-unused */ $next) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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 ignore-type  annotation

32
Filters::apply($this, 'coverage', /** @scrutinizer ignore-type */ function ($next) {
Loading history...
33
    if (! extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') {
34
        return;
35
    }
36
    $reporters = $this->reporters();
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
37
    $coverage = new Coverage([
38
        'verbosity' => $this->commandLine()->get('coverage'),
39
        'driver' => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(),
40
        'path' => $this->commandLine()->get('src'),
41
        'colors' => ! $this->commandLine()->get('no-colors'),
42
    ]);
43
    $reporters->add('coverage', $coverage);
44
});
45