1 | <?php |
||
14 | trait ProxyTrait |
||
15 | { |
||
16 | /** |
||
17 | * @var object |
||
18 | */ |
||
19 | private $__moka_mock; |
||
20 | |||
21 | /** |
||
22 | * @var MockingStrategyInterface |
||
23 | */ |
||
24 | private $__moka_mockingStrategy; |
||
25 | |||
26 | /** |
||
27 | * @return object |
||
28 | */ |
||
29 | 4 | public function __moka_getMock() |
|
33 | |||
34 | /** |
||
35 | * @param object $mock |
||
36 | * @return ProxyInterface|ProxyTrait |
||
37 | */ |
||
38 | 16 | public function __moka_setMock($mock): self |
|
44 | |||
45 | /** |
||
46 | * @param MockingStrategyInterface $mockingStrategy |
||
47 | * @return ProxyInterface|ProxyTrait |
||
48 | */ |
||
49 | 14 | public function __moka_setMockingStrategy(MockingStrategyInterface $mockingStrategy): self |
|
55 | |||
56 | /** |
||
57 | * @param array $namesWithValues |
||
58 | * @return ProxyInterface |
||
59 | * |
||
60 | * @throws InvalidArgumentException |
||
61 | * @throws MockNotCreatedException |
||
62 | */ |
||
63 | 1 | public function stub(array $namesWithValues): ProxyInterface |
|
70 | |||
71 | /** |
||
72 | * @param string $name |
||
73 | * @param array $arguments |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 6 | protected function doCall(string $name, array $arguments) |
|
86 | |||
87 | /** |
||
88 | * @param string $name |
||
89 | * @return mixed |
||
90 | */ |
||
91 | 3 | protected function doGet(string $name) |
|
99 | } |
||
100 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: