These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | class DMSUploadField_ItemHandler extends UploadField_ItemHandler |
||
4 | { |
||
5 | private static $allowed_actions = array( |
||
6 | 'delete', |
||
7 | 'edit', |
||
8 | 'EditForm', |
||
9 | ); |
||
10 | |||
11 | /** |
||
12 | * Gets a DMS document by its ID |
||
13 | * |
||
14 | * @return DMSDocument |
||
0 ignored issues
–
show
|
|||
15 | */ |
||
16 | public function getItem() |
||
17 | { |
||
18 | return DMSDocument::get()->byId($this->itemID); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @return Form |
||
23 | */ |
||
24 | public function EditForm() |
||
25 | { |
||
26 | $file = $this->getItem(); |
||
27 | |||
28 | // Get form components |
||
29 | $fields = $this->parent->getDMSFileEditFields($file); |
||
30 | $actions = $this->parent->getDMSFileEditActions($file); |
||
31 | $validator = $this->parent->getDMSFileEditValidator($file); |
||
32 | $form = new Form( |
||
33 | $this, |
||
0 ignored issues
–
show
$this is of type this<DMSUploadField_ItemHandler> , but the function expects a object<Controller> .
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: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
34 | __FUNCTION__, |
||
35 | $fields, |
||
36 | $actions, |
||
37 | $validator |
||
38 | ); |
||
39 | $form->loadDataFrom($file); |
||
40 | |||
41 | return $form; |
||
42 | } |
||
43 | } |
||
44 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.