Issues (49)

kahlan-config.php (5 issues)

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\Coveralls;
7
8
$commandLine = $this->commandLine();
9
$commandLine->option('ff', 'default', 1);
10
$commandLine->option('coverage-coveralls', 'default', 'coveralls.json');
11
12
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

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

31
Filters::apply($this, 'coverage', /** @scrutinizer ignore-type */ function($next) {
Loading history...
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

31
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...
32
    if (!extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') {
33
        return;
34
    }
35
    $reporters = $this->reporters();
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
36
    $coverage = new Coverage([
37
        'verbosity' => $this->commandLine()->get('coverage'),
38
        'driver'    => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(),
39
        'path'      => $this->commandLine()->get('src'),
40
        'colors'    => !$this->commandLine()->get('no-colors')
41
    ]);
42
    $reporters->add('coverage', $coverage);
43
});
44
45
require_once realpath(rtrim(getcwd(), '\\/ ')).DIRECTORY_SEPARATOR.'spec'.DIRECTORY_SEPARATOR.'bootstrap.php';
46