File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
/**
18
18
* Session and Cookies must be used only in HTML Presentation layer.
19
+ *
20
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19
21
*/
20
22
class CookieAndSessionMisuse extends AbstractRule implements ClassAware
21
23
{
@@ -67,6 +69,19 @@ private function isLayoutProcessor(\ReflectionClass $class): bool
67
69
);
68
70
}
69
71
72
+ /**
73
+ * Is given class a View Model?
74
+ *
75
+ * @param \ReflectionClass $class
76
+ * @return bool
77
+ */
78
+ private function isViewModel (\ReflectionClass $ class ): bool
79
+ {
80
+ return $ class ->isSubclassOf (
81
+ \Magento \Framework \View \Element \Block \ArgumentInterface::class
82
+ );
83
+ }
84
+
70
85
/**
71
86
* Is given class an HTML UI Document?
72
87
*
@@ -191,6 +206,7 @@ public function apply(AbstractNode $node)
191
206
&& !$ this ->isControllerPlugin ($ class )
192
207
&& !$ this ->isBlockPlugin ($ class )
193
208
&& !$ this ->isLayoutProcessor ($ class )
209
+ && !$ this ->isViewModel ($ class )
194
210
) {
195
211
$ this ->addViolation ($ node , [$ node ->getFullQualifiedName ()]);
196
212
}
You can’t perform that action at this time.
0 commit comments