| 1 | <?php |
||
| 10 | class PropertyTemplate implements TemplateInterface |
||
| 11 | { |
||
| 12 | use VisibilityTrait; |
||
| 13 | |||
| 14 | const TEMPLATE = ' |
||
| 15 | %s %s $%s; |
||
| 16 | '; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param \ReflectionProperty $property |
||
| 20 | * @return string |
||
| 21 | */ |
||
| 22 | 4 | public static function generate(\Reflector $property): string |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param \ReflectionProperty $property |
||
| 29 | * @return string |
||
| 30 | */ |
||
| 31 | 4 | protected static function doGenerate(\ReflectionProperty $property): string |
|
| 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.