Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 3 | public static function download($from, $to) |
|
21 | { |
||
22 | /** |
||
23 | * @var bool|resource $fromStream |
||
24 | */ |
||
25 | 3 | $fromStream = File::open($from); |
|
26 | |||
27 | 3 | if (!$fromStream) |
|
28 | { |
||
29 | 1 | throw new NotFound\Path('Stream `' . $from . '` not found'); |
|
30 | } |
||
31 | |||
32 | 2 | if (!File::real($to) && !File::touch($to)) |
|
33 | { |
||
34 | 1 | throw new Exceptions\PermissionDenied('File `' . $to . '`'); |
|
35 | } |
||
36 | |||
37 | 1 | File::put($to, $fromStream); |
|
38 | |||
39 | 1 | return File::close($fromStream); |
|
|
|||
40 | } |
||
41 | |||
43 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: