Issues (142)

ProcessorInterface.php (3 issues)

Labels
Severity
1
<?php
2
3
/*
4
 * This file is part of the doyo/code-coverage project.
5
 *
6
 * (c) Anthonius Munthi <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Doyo\Bridge\CodeCoverage;
15
16
use SebastianBergmann\CodeCoverage\CodeCoverage;
0 ignored issues
show
The type SebastianBergmann\CodeCoverage\CodeCoverage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
This use statement conflicts with another class in this namespace, Doyo\Bridge\CodeCoverage\CodeCoverage. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
17
use SebastianBergmann\CodeCoverage\Filter;
0 ignored issues
show
The type SebastianBergmann\CodeCoverage\Filter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
interface ProcessorInterface
20
{
21
    /**
22
     * Set current test case for code coverage.
23
     *
24
     * @param TestCase $testCase
25
     */
26
    public function setCurrentTestCase(TestCase $testCase);
27
28
    /**
29
     * Get current test case for code coverage.
30
     *
31
     * @return TestCase:null
32
     */
33
    public function getCurrentTestCase();
34
35
    /**
36
     * @return Filter
37
     */
38
    public function getCodeCoverageFilter();
39
40
    /**
41
     * Set code coverage options.
42
     *
43
     * @param array $options
44
     */
45
    public function setCodeCoverageOptions(array $options);
46
47
    /**
48
     * Get code coverage options.
49
     *
50
     * @return array
51
     */
52
    public function getCodeCoverageOptions();
53
54
    /**
55
     * @return CodeCoverage
56
     */
57
    public function getCodeCoverage();
58
59
    /**
60
     * Add test case.
61
     *
62
     * @param TestCase $testCase
63
     */
64
    public function addTestCase(TestCase $testCase);
65
66
    /**
67
     * Merge code coverage from another processor.
68
     *
69
     * @param ProcessorInterface|CodeCoverage $processor
70
     */
71
    public function merge($processor);
72
73
    /**
74
     * @param TestCase $testCase
75
     */
76
    public function start(TestCase $testCase);
77
78
    /**
79
     * @param bool  $append
80
     * @param array $linesToBeCovered
81
     * @param array $linesToBeUsed
82
     * @param bool  $ignoreForceCoversAnnotation
83
     *
84
     * @return array
85
     */
86
    public function stop(bool $append = true, $linesToBeCovered = [], array $linesToBeUsed = [], bool $ignoreForceCoversAnnotation = false): array;
87
88
    /**
89
     * Complete code coverage collecting process.
90
     */
91
    public function complete();
92
93
    /**
94
     * Clear code coverage.
95
     */
96
    public function clear();
97
}
98