1 | <?php |
||
19 | abstract class AbstractFormRenderer implements FormRendererInterface |
||
20 | { |
||
21 | /** @var DOMDocument $dom */ |
||
22 | protected $dom; |
||
23 | |||
24 | /** @var DomElement $form */ |
||
25 | protected $form; |
||
26 | |||
27 | /** @var bool $displayErrors */ |
||
28 | protected $displayErrors; |
||
29 | |||
30 | /** @var ErrorRendererInterface $errorRenderer */ |
||
31 | protected $errorRenderer; |
||
32 | |||
33 | /** @var DomElement $label The label element*/ |
||
34 | protected $label; |
||
35 | |||
36 | /** @var DomElement $element the field element */ |
||
37 | protected $element; |
||
38 | |||
39 | /** @var DomElement $errors The error block html*/ |
||
40 | protected $errors; |
||
41 | |||
42 | /** @var DomElement $block The containing html block */ |
||
43 | protected $block; |
||
44 | |||
45 | /** @var FieldInterface $field The current field being processed */ |
||
46 | protected $field; |
||
47 | |||
48 | 23 | public function __construct() |
|
54 | |||
55 | /** |
||
56 | * @param FormInterface $form |
||
57 | * @param bool $displayErrors |
||
58 | * @return string |
||
59 | */ |
||
60 | 10 | public function render(FormInterface $form, $displayErrors = true) |
|
71 | |||
72 | /** |
||
73 | * @param FormInterface $form |
||
74 | */ |
||
75 | 10 | private function setFormAttributes(FormInterface $form) |
|
89 | |||
90 | /** |
||
91 | * @param FormInterface $form |
||
92 | * @return string |
||
93 | */ |
||
94 | 10 | private function getMethod(FormInterface $form) |
|
98 | |||
99 | /** |
||
100 | * @param FormInterface $form |
||
101 | * @return string |
||
102 | */ |
||
103 | 10 | private function getId(FormInterface $form) |
|
107 | |||
108 | 10 | private function processFields(FieldCollection $fields) |
|
123 | |||
124 | |||
125 | |||
126 | /** |
||
127 | * @return DOMElement|null |
||
128 | */ |
||
129 | 5 | public function renderError() |
|
138 | |||
139 | /** |
||
140 | * @return DOMElement |
||
141 | */ |
||
142 | 9 | protected function createLabelElement() |
|
148 | |||
149 | } |
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
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. 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.