1 | <?php |
||
17 | class ProxyGenerator |
||
18 | { |
||
19 | /** |
||
20 | * @var MockingStrategyInterface |
||
21 | */ |
||
22 | private $mockingStrategy; |
||
23 | |||
24 | /** |
||
25 | * ProxyGenerator constructor. |
||
26 | * @param MockingStrategyInterface $mockingStrategy |
||
27 | */ |
||
28 | 4 | public function __construct(MockingStrategyInterface $mockingStrategy) |
|
32 | |||
33 | /** |
||
34 | * @param string $fqcn |
||
35 | * @return ProxyInterface |
||
36 | * |
||
37 | * @throws MockNotCreatedException |
||
38 | * @throws InvalidArgumentException |
||
39 | */ |
||
40 | 10 | public function get(string $fqcn): ProxyInterface |
|
53 | |||
54 | /** |
||
55 | * @param string $proxyFQCN |
||
56 | * @return ProxyInterface|ProxyTrait |
||
57 | */ |
||
58 | 10 | protected function getInstance(string $proxyFQCN): ProxyInterface |
|
67 | } |
||
68 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: