Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function testGetter() |
||
13 | { |
||
14 | /** @var ContainerInterface|\PHPUnit_Framework_MockObject_MockObject $container */ |
||
15 | $container = $this->getMockBuilder(ContainerInterface::class) |
||
16 | ->disableOriginalConstructor() |
||
17 | ->getMock(); |
||
18 | |||
19 | $container->method('get')->willReturn(new IdentityTranslator()); |
||
20 | |||
21 | $obj = new UsingTranslator($container); |
||
|
|||
22 | |||
23 | $this->assertInstanceOf(IdentityTranslator::class, $obj->getIt()); |
||
24 | } |
||
25 | } |
||
26 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.