-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
DefaultArgumentRemoverReturnTypes84.php
81 lines (70 loc) · 1.98 KB
/
DefaultArgumentRemoverReturnTypes84.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace phpmock\phpunit;
use phpmock\generator\MockFunctionGenerator;
use PHPUnit\Framework\MockObject\Invocation;
use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
/**
* Removes default arguments from the invocation.
*
* @author Markus Malkusch <markus@malkusch.de>
* @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
* @license http://www.wtfpl.net/txt/copying/ WTFPL
* @internal
*/
class DefaultArgumentRemoverReturnTypes84 extends InvocationOrder
{
/**
* @SuppressWarnings(PHPMD)
*/
public function invokedDo(Invocation $invocation)
{
}
/**
* @SuppressWarnings(PHPMD)
*/
public function matches(Invocation $invocation) : bool
{
$iClass = class_exists(Invocation::class);
if ($iClass
|| $invocation instanceof Invocation\StaticInvocation
) {
$this->removeDefaultArguments(
$invocation,
$iClass ? Invocation::class : Invocation\StaticInvocation::class
);
} else {
MockFunctionGenerator::removeDefaultArguments($invocation->parameters);
}
return false;
}
public function verify() : void
{
}
/**
* This method is not defined in the interface, but used in
* PHPUnit_Framework_MockObject_InvocationMocker::hasMatchers().
*
* @return boolean
* @see \PHPUnit_Framework_MockObject_InvocationMocker::hasMatchers()
*/
public function hasMatchers()
{
return false;
}
public function toString() : string
{
return __CLASS__;
}
/**
* Remove default arguments from StaticInvocation or its children (hack)
*
* @SuppressWarnings(PHPMD)
*/
private function removeDefaultArguments(Invocation $invocation, string $class)
{
$remover = function () {
MockFunctionGenerator::removeDefaultArguments($this->parameters);
};
$remover->bindTo($invocation, $class)();
}
}