| Conditions | 1 |
| Paths | 1 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 8 | final public function generate($fqcn): ProxyInterface |
|
| 20 | { |
||
| 21 | 8 | $object = $this->mockingStrategy->build($fqcn); |
|
| 22 | 8 | $codeWillBeEvaluated = ProxyClassGenerator::generateCode(get_class($object)); |
|
| 23 | |||
| 24 | /** @var ProxyInterface|ProxyTrait $proxy */ |
||
| 25 | 8 | $proxy = eval($codeWillBeEvaluated); |
|
| 26 | 8 | $proxy->_moka_setObject($object); |
|
|
|
|||
| 27 | 8 | $proxy->_moka_setMockingStrategy($this->mockingStrategy); |
|
| 28 | |||
| 29 | 8 | return $proxy; |
|
| 30 | } |
||
| 31 | } |
||
| 32 |
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: