| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function testBodyStructure() : void |
||
| 26 | { |
||
| 27 | $reflection = new ReflectionClass(EmptyClass::class); |
||
| 28 | $initializer = $this->createMock(PropertyGenerator::class); |
||
|
|
|||
| 29 | $initMethod = $this->createMock(MethodGenerator::class); |
||
| 30 | |||
| 31 | $initializer->method('getName')->willReturn('foo'); |
||
| 32 | $initMethod->method('getName')->willReturn('bar'); |
||
| 33 | |||
| 34 | $magicSleep = new MagicSleep($reflection, $initializer, $initMethod); |
||
| 35 | |||
| 36 | self::assertSame('__sleep', $magicSleep->getName()); |
||
| 37 | self::assertCount(0, $magicSleep->getParameters()); |
||
| 38 | self::assertSame( |
||
| 39 | "\$this->foo && \$this->bar('__sleep', []);" |
||
| 40 | . "\n\nreturn array_keys((array) \$this);", |
||
| 41 | $magicSleep->getBody() |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
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.