1 | <?php |
||
24 | class ConvertEncoding implements FileModifierInterface, LoggerAwareInterface, ProcessFactoryAwareInterface |
||
25 | { |
||
26 | use OptionalLoggerTrait; |
||
27 | use FileProcessTrait; |
||
28 | use GetOptionTrait; |
||
29 | |||
30 | /** |
||
31 | * @extend Graze\DataFile\Node\File\LocalFile Only apply to local files |
||
32 | * |
||
33 | * @param LocalFile $file |
||
34 | * @param string $encoding Encoding as defined by iconv |
||
35 | * @param array $options -postfix <string> (Default: toEncoding) |
||
36 | * -keepOldFile <bool> (Default: true) |
||
37 | * |
||
38 | * @return LocalFile |
||
39 | */ |
||
40 | 6 | public function toEncoding(LocalFile $file, $encoding, array $options = []) |
|
70 | |||
71 | /** |
||
72 | * Can this file be modified by this modifier |
||
73 | * |
||
74 | * @param FileNodeInterface $file |
||
75 | * |
||
76 | * @return bool |
||
77 | */ |
||
78 | 1 | public function canModify(FileNodeInterface $file) |
|
85 | |||
86 | /** |
||
87 | * Modify the file |
||
88 | * |
||
89 | * @param FileNodeInterface $file |
||
90 | * @param array $options List of options: |
||
91 | * -encoding <string> |
||
92 | * -postfix <string> (Default: toEncoding) Set this to blank to replace inline |
||
93 | * -keepOldFile <bool> (Default: true) |
||
94 | * |
||
95 | * @return FileNodeInterface |
||
96 | */ |
||
97 | public function modify(FileNodeInterface $file, array $options = []) |
||
109 | } |
||
110 |
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.