Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
31 | 4 | protected static function doGenerate(\ReflectionProperty $property): string |
|
32 | { |
||
33 | 4 | $visibility = static::getVisibility($property); |
|
34 | |||
35 | 4 | $static = $property->isStatic() ? 'static' : ''; |
|
36 | |||
37 | 4 | $name = $property->name; |
|
38 | |||
39 | 4 | return sprintf( |
|
40 | 4 | self::TEMPLATE, |
|
41 | 4 | $visibility, |
|
42 | 4 | $static, |
|
43 | 4 | $name |
|
44 | ); |
||
45 | } |
||
46 | } |
||
47 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.