Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function __toString() |
||
28 | { |
||
29 | $string = parent::__toString(); |
||
30 | if (\Yii::$app->request instanceof Request && \Yii::$app->request->checksumIsEnabled()) { |
||
31 | if (preg_match('#<input|<select|<textarea#', $string)) { |
||
32 | $attribute = Html::getAttributeName($this->attribute); |
||
33 | \Yii::$app->request->stackField($this->form->id, $this->model->formName(), $attribute); |
||
34 | } |
||
35 | } |
||
36 | return $string; |
||
37 | } |
||
38 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: