| Conditions | 7 |
| Paths | 16 |
| Total Lines | 32 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 7.0052 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 8 | public static function generateMethodString(\ReflectionMethod $method) |
|
| 16 | { |
||
| 17 | 8 | $static = $method->isStatic() ? 'static' : ''; |
|
| 18 | 8 | $originalReturnType = $method->getReturnType(); |
|
| 19 | |||
| 20 | 8 | $returnType = !$originalReturnType ? '' : ProxyReturnGenerator::generateMethodReturnType($originalReturnType, $method); |
|
| 21 | |||
| 22 | 8 | $parameters = $method->getParameters(); |
|
| 23 | 8 | $arguments = []; |
|
| 24 | 8 | if ($parameters) { |
|
|
|
|||
| 25 | 8 | foreach ($method->getParameters() as $parameter) { |
|
| 26 | 8 | $arguments[] = ProxyArgumentGenerator::generateMethodParameter($parameter); |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 8 | $method->getReturnType(); |
|
| 31 | |||
| 32 | 8 | $returnStatement = 'return '; |
|
| 33 | 8 | if (null !== $originalReturnType && self::getType($originalReturnType) === 'void') { |
|
| 34 | $returnStatement = ''; |
||
| 35 | } |
||
| 36 | |||
| 37 | 8 | return sprintf( |
|
| 38 | 8 | self::$template, |
|
| 39 | 8 | $static, |
|
| 40 | 8 | $method->getName(), |
|
| 41 | 8 | implode(', ', $arguments), |
|
| 42 | 8 | $returnType, |
|
| 43 | 8 | $returnStatement, |
|
| 44 | 8 | $method->getName() |
|
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 53 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.