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