Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function testBodyStructure() : void |
||
25 | { |
||
26 | $valueHolder = $this->createMock(PropertyGenerator::class); |
||
|
|||
27 | $prefixInterceptors = $this->createMock(PropertyGenerator::class); |
||
28 | $suffixInterceptors = $this->createMock(PropertyGenerator::class); |
||
29 | |||
30 | $valueHolder->method('getName')->willReturn('foo'); |
||
31 | $prefixInterceptors->method('getName')->willReturn('pre'); |
||
32 | $suffixInterceptors->method('getName')->willReturn('post'); |
||
33 | |||
34 | $method = InterceptedMethod::generateMethod( |
||
35 | new MethodReflection(BaseClass::class, 'publicByReferenceParameterMethod'), |
||
36 | $valueHolder, |
||
37 | $prefixInterceptors, |
||
38 | $suffixInterceptors |
||
39 | ); |
||
40 | |||
41 | self::assertSame('publicByReferenceParameterMethod', $method->getName()); |
||
42 | self::assertCount(2, $method->getParameters()); |
||
43 | self::assertGreaterThan( |
||
44 | 0, |
||
45 | strpos( |
||
46 | $method->getBody(), |
||
47 | '$returnValue = $this->foo->publicByReferenceParameterMethod($param, $byRefParam);' |
||
48 | ) |
||
49 | ); |
||
50 | } |
||
51 | } |
||
52 |
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.