x-systems /
epesi-filestorage
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Epesi\FileStorage\View; |
||||
| 4 | |||||
| 5 | use atk4\ui\Modal; |
||||
| 6 | use atk4\ui\jsExpression; |
||||
| 7 | |||||
| 8 | class FileModal extends Modal |
||||
| 9 | { |
||||
| 10 | public $defaultPeriod = '1 weeks'; |
||||
| 11 | |||||
| 12 | public $periodSelection; |
||||
| 13 | |||||
| 14 | public function init() |
||||
| 15 | { |
||||
| 16 | $this->title = __('File'); |
||||
|
0 ignored issues
–
show
|
|||||
| 17 | |||||
| 18 | parent::init(); |
||||
| 19 | |||||
| 20 | $this->set(\Closure::fromCallable([$this, 'addContents'])); |
||||
|
0 ignored issues
–
show
Closure::fromCallable(ar...($this, 'addContents')) of type Closure is incompatible with the type array|string expected by parameter $fx of atk4\ui\Modal::set().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 21 | } |
||||
| 22 | |||||
| 23 | protected function addContents($canvas) |
||||
| 24 | { |
||||
| 25 | $canvas->add([ |
||||
| 26 | new FileView($canvas->stickyGET('id')), |
||||
| 27 | 'defaultPeriod' => $this->defaultPeriod, |
||||
| 28 | 'periodSelection' => $this->periodSelection |
||||
| 29 | ]); |
||||
| 30 | } |
||||
| 31 | |||||
| 32 | public function show($args = []) |
||||
| 33 | { |
||||
| 34 | return parent::show(array_merge([ |
||||
| 35 | 'id' => new jsExpression('$(this).closest("tr").data("id")') |
||||
| 36 | ], $args)); |
||||
| 37 | } |
||||
| 38 | } |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.