Passed
Push — master ( 43c003...f5456e )
by Gaetano
07:42
created

PhpXmlRpc_PolyfillTestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 2
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fail() 0 3 1
A _run() 0 2 1
A run() 0 2 1
A _fail() 0 1 1
1
<?php
2
3
use PHPUnit\Framework\TestResult;
4
use PHPUnit\Runner\Version as PHPUnit_Version;
5
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
6
7
if (class_exists('PhpXmlRpc_PolyfillTestCase')) {
8
    return;
9
}
10
11
if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
12
    abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
13
    {
14
        public function _run($result = null) {
15
            return parent::run($result);
16
        }
17
18
        public static function _fail() {}
19
20
        public function run($result = null) {
21
            return $this->_run($result);
22
        }
23
24
        public static function fail($message = '') {
25
            static::_fail($message);
0 ignored issues
show
Unused Code introduced by
The call to PhpXmlRpc_PolyfillTestCase::_fail() has too many arguments starting with $message. ( Ignorable by Annotation )

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

25
            static::/** @scrutinizer ignore-call */ 
26
                    _fail($message);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
26
            self::fail($message);
27
        }
28
    }
29
} else {
30
    abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
31
    {
32
        public function _run(TestResult $result = null) {
33
            return parent::run($result);
34
        }
35
36
        public static function _fail() {}
37
38
        public function run(TestResult $result = null): TestResult {
39
            return $this->_run($result);
40
        }
41
42
        public static function fail(string $message = ''): void {
43
            static::_fail($message);
0 ignored issues
show
Unused Code introduced by
The call to PhpXmlRpc_PolyfillTestCase::_fail() has too many arguments starting with $message. ( Ignorable by Annotation )

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

43
            static::/** @scrutinizer ignore-call */ 
44
                    _fail($message);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
44
            parent::fail($message);
45
        }
46
    }
47
}
48