| 1 | <?php |
||
| 14 | class TextFileWriter |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var File |
||
| 18 | */ |
||
| 19 | protected $file; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param File $file |
||
| 23 | */ |
||
| 24 | public function __construct(File $file) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * write file to disk |
||
| 31 | */ |
||
| 32 | public function writeFile() |
||
| 37 | |||
| 38 | protected function writeFileToDisk() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | protected function validateFile() |
||
| 50 | } |
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.