These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | include __DIR__ . '/bootstrap.php'; |
||
3 | |||
4 | use Slince\Upload\UploadHandlerBuilder; |
||
5 | |||
6 | $builder = new UploadHandlerBuilder(); |
||
7 | $handler = $builder |
||
8 | ->saveTo(__DIR__ . '/dst') |
||
9 | ->getHandler(); |
||
10 | |||
11 | $files = $handler->handle(); |
||
12 | |||
13 | foreach ($files as $file) { |
||
0 ignored issues
–
show
|
|||
14 | if ($file instanceof \Exception) { |
||
15 | echo 'upload error: ' . $file->getMessage(), PHP_EOL; |
||
16 | } else { |
||
17 | echo 'upload ok, path:' . $file->getPathname(); |
||
18 | } |
||
19 | } |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.