1 | <?php |
||
25 | class ConditionProcessor |
||
26 | { |
||
27 | /** |
||
28 | * @var FormObject |
||
29 | */ |
||
30 | private $formObject; |
||
31 | |||
32 | /** |
||
33 | * @var ConditionTree[] |
||
34 | */ |
||
35 | private $fieldsTrees = []; |
||
36 | |||
37 | /** |
||
38 | * @var ConditionTree[] |
||
39 | */ |
||
40 | private $validationsTrees = []; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | private $javaScriptFiles = []; |
||
46 | |||
47 | /** |
||
48 | * @param FormObject $formObject |
||
49 | */ |
||
50 | public function __construct(FormObject $formObject) |
||
54 | |||
55 | /** |
||
56 | * Returns the condition tree for a given field instance, giving access to |
||
57 | * CSS, JavaScript and PHP transpiled results. |
||
58 | * |
||
59 | * @param Field $field |
||
60 | * @return ConditionTree |
||
61 | */ |
||
62 | public function getActivationConditionTreeForField(Field $field) |
||
72 | |||
73 | /** |
||
74 | * Returns the condition tree for a given validation instance, giving access |
||
75 | * to CSS, JavaScript and PHP transpiled results. |
||
76 | * |
||
77 | * @param Validation $validation |
||
78 | * @return ConditionTree |
||
79 | */ |
||
80 | public function getActivationConditionTreeForValidation(Validation $validation) |
||
90 | |||
91 | /** |
||
92 | * @param ActivationInterface $activation |
||
93 | * @return ConditionTree |
||
94 | */ |
||
95 | protected function getConditionTree(ActivationInterface $activation) |
||
101 | |||
102 | /** |
||
103 | * Function that will calculate all trees from fields and their validation |
||
104 | * rules. |
||
105 | * |
||
106 | * This is useful to be able to store this instance in cache. |
||
107 | */ |
||
108 | public function calculateAllTrees() |
||
126 | |||
127 | /** |
||
128 | * @param NodeInterface $node |
||
129 | */ |
||
130 | protected function attachNodeJavaScriptFiles(NodeInterface $node) |
||
142 | |||
143 | /** |
||
144 | * @param FormObject $formObject |
||
145 | */ |
||
146 | public function attachFormObject(FormObject $formObject) |
||
150 | |||
151 | /** |
||
152 | * @return FormObject |
||
153 | */ |
||
154 | public function getFormObject() |
||
158 | |||
159 | /** |
||
160 | * @return array |
||
161 | */ |
||
162 | public function getJavaScriptFiles() |
||
166 | |||
167 | /** |
||
168 | * @return array |
||
169 | */ |
||
170 | public function __sleep() |
||
174 | } |
||
175 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.