| 1 | <?php |
||
| 7 | class Checkbox extends Field { |
||
| 8 | |||
| 9 | public $value = false; |
||
| 10 | |||
| 11 | 7 | public function getValue() |
|
| 12 | { |
||
| 13 | 7 | return $this->value; |
|
| 14 | } |
||
| 15 | |||
| 16 | 9 | public function getButtonName() |
|
| 17 | { |
||
| 18 | 9 | // |
|
| 19 | } |
||
| 20 | |||
| 21 | 5 | public function renderWith() |
|
| 22 | { |
||
| 23 | 5 | return ['checked' => $this->value]; |
|
| 24 | } |
||
| 25 | |||
| 26 | 5 | public function setChecked() |
|
| 31 | |||
| 32 | 2 | public function setUnchecked() |
|
| 37 | |||
| 38 | 9 | public function setValueFromDefault() |
|
| 39 | { |
||
| 40 | 9 | $this->value = $this->default; |
|
| 41 | 9 | } |
|
| 42 | |||
| 43 | 1 | public function setValueFromModel($model) |
|
| 44 | { |
||
| 45 | 1 | if (property_exists($model, $this->name)) $this->value = $model->{$this->name} ? true : false; |
|
| 46 | 1 | } |
|
| 47 | |||
| 48 | public function setValueFromRequest($request) |
||
| 49 | { |
||
| 50 | $this->value = $request->get($this->name) ? true : false; |
||
| 51 | } |
||
| 52 | |||
| 53 | 1 | public function fillModelWithValue($model) |
|
| 54 | { |
||
| 55 | 1 | if (property_exists($model, $this->name)) $model->{$this->name} = $this->value ? 1 : 0; |
|
| 56 | 1 | } |
|
| 57 | |||
| 58 | 1 | public function validateRequired() |
|
| 62 | |||
| 63 | } |
||
| 64 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..