1 | <?php |
||
2 | |||
3 | use PHPUnit\Framework\TestResult as PHPUnit_Framework_TestResult; |
||
4 | use Yoast\PHPUnitPolyfills\TestCases\TestCase; |
||
5 | |||
6 | // allow hooking code to run within `run` and `fail` via defining `_run` and `_fail` in subclasses |
||
7 | abstract class PhpXmlRpc_PolyfillTestCase extends TestCase |
||
8 | { |
||
9 | public function _run($result = null) { |
||
10 | return parent::run($result); |
||
11 | } |
||
12 | |||
13 | public static function _fail() {} |
||
14 | |||
15 | public function run(PHPUnit_Framework_TestResult $result = null): PHPUnit_Framework_TestResult { |
||
16 | return $this->_run($result); |
||
17 | } |
||
18 | |||
19 | public static function fail(string $message = ''): void { |
||
20 | static::_fail($message); |
||
0 ignored issues
–
show
|
|||
21 | parent::fail($message); |
||
22 | } |
||
23 | } |
||
24 |
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.