Issues (27)

kahlan-config.php (3 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');
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
        'service_name'   => 'travis-ci',
27
        'service_job_id' => getenv('TRAVIS_JOB_ID') ?: null
28
    ]);
29
30
    return $next();
31
});
32
33
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

33
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

33
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...
34
    if (!extension_loaded('xdebug') && PHP_SAPI !== 'phpdbg') {
35
        return;
36
    }
37
    $reporters = $this->reporters();
38
    $coverage = new Coverage([
39
        'verbosity' => $this->commandLine()->get('coverage'),
40
        'driver'    => PHP_SAPI !== 'phpdbg' ? new Xdebug() : new Phpdbg(),
41
        'path'      => $this->commandLine()->get('src'),
42
        'colors'    => !$this->commandLine()->get('no-colors')
43
    ]);
44
    $reporters->add('coverage', $coverage);
45
});
46
47
require_once realpath(rtrim(getcwd(), '\\/ ')).DIRECTORY_SEPARATOR.'spec'.DIRECTORY_SEPARATOR.'bootstrap.php';
48