| Conditions | 1 |
| Paths | 1 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function testBodyStructure() : void |
||
| 27 | { |
||
| 28 | $reflection = new ReflectionClass(EmptyClass::class); |
||
| 29 | $valueHolder = $this->createMock(PropertyGenerator::class); |
||
|
|
|||
| 30 | $prefixInterceptors = $this->createMock(PropertyGenerator::class); |
||
| 31 | $suffixInterceptors = $this->createMock(PropertyGenerator::class); |
||
| 32 | $publicProperties = $this->createMock(PublicPropertiesMap::class); |
||
| 33 | |||
| 34 | $valueHolder->method('getName')->willReturn('bar'); |
||
| 35 | $prefixInterceptors->method('getName')->willReturn('pre'); |
||
| 36 | $suffixInterceptors->method('getName')->willReturn('post'); |
||
| 37 | $publicProperties->method('isEmpty')->willReturn(false); |
||
| 38 | |||
| 39 | $magicUnset = new MagicUnset( |
||
| 40 | $reflection, |
||
| 41 | $valueHolder, |
||
| 42 | $prefixInterceptors, |
||
| 43 | $suffixInterceptors, |
||
| 44 | $publicProperties |
||
| 45 | ); |
||
| 46 | |||
| 47 | self::assertSame('__unset', $magicUnset->getName()); |
||
| 48 | self::assertCount(1, $magicUnset->getParameters()); |
||
| 49 | self::assertGreaterThan( |
||
| 50 | 0, |
||
| 51 | strpos($magicUnset->getBody(), 'unset($this->bar->$name);') |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
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.