1 | <?php |
||
24 | class ConditionProcessor |
||
25 | { |
||
26 | /** |
||
27 | * @var FormObject |
||
28 | */ |
||
29 | private $formObject; |
||
30 | |||
31 | /** |
||
32 | * @var ConditionTree[] |
||
33 | */ |
||
34 | private $fieldsTrees = []; |
||
35 | |||
36 | /** |
||
37 | * @var ConditionTree[] |
||
38 | */ |
||
39 | private $validationsTrees = []; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | private $javaScriptFiles = []; |
||
45 | |||
46 | /** |
||
47 | * @param FormObject $formObject |
||
48 | */ |
||
49 | public function __construct(FormObject $formObject) |
||
53 | |||
54 | /** |
||
55 | * Returns the condition tree for a given field instance, giving access to |
||
56 | * CSS, JavaScript and PHP transpiled results. |
||
57 | * |
||
58 | * @param Field $field |
||
59 | * @return ConditionTree |
||
60 | */ |
||
61 | public function getActivationConditionTreeForField(Field $field) |
||
71 | |||
72 | /** |
||
73 | * Returns the condition tree for a given validation instance, giving access |
||
74 | * to CSS, JavaScript and PHP transpiled results. |
||
75 | * |
||
76 | * @param Validation $validation |
||
77 | * @return ConditionTree |
||
78 | */ |
||
79 | public function getActivationConditionTreeForValidation(Validation $validation) |
||
91 | |||
92 | /** |
||
93 | * Function that will calculate all trees from fields and their validation |
||
94 | * rules. |
||
95 | * |
||
96 | * This is useful to be able to store this instance in cache. |
||
97 | */ |
||
98 | public function calculateAllTrees() |
||
115 | |||
116 | /** |
||
117 | * @param NodeInterface $node |
||
118 | */ |
||
119 | protected function attachNodeJavaScriptFiles(NodeInterface $node) |
||
131 | |||
132 | /** |
||
133 | * @param FormObject $formObject |
||
134 | */ |
||
135 | public function attachFormObject(FormObject $formObject) |
||
139 | |||
140 | /** |
||
141 | * @return FormObject |
||
142 | */ |
||
143 | public function getFormObject() |
||
147 | |||
148 | /** |
||
149 | * @return array |
||
150 | */ |
||
151 | public function getJavaScriptFiles() |
||
155 | |||
156 | /** |
||
157 | * @return array |
||
158 | */ |
||
159 | public function __sleep() |
||
163 | } |
||
164 |
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.