| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function testCantAddAFinalMethod() : void |
||
| 25 | { |
||
| 26 | $classGenerator = $this->createMock(ClassGenerator::class); |
||
|
|
|||
| 27 | $methodGenerator = $this->createMock(MethodGenerator::class); |
||
| 28 | |||
| 29 | $methodGenerator |
||
| 30 | ->expects(self::once()) |
||
| 31 | ->method('getName') |
||
| 32 | ->willReturn('foo'); |
||
| 33 | |||
| 34 | $classGenerator |
||
| 35 | ->expects(self::never()) |
||
| 36 | ->method('addMethodFromGenerator'); |
||
| 37 | |||
| 38 | $reflection = new ReflectionClass(ClassWithFinalMethods::class); |
||
| 39 | |||
| 40 | self::assertFalse(ClassGeneratorUtils::addMethodIfNotFinal($reflection, $classGenerator, $methodGenerator)); |
||
| 41 | } |
||
| 42 | |||
| 62 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.