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 1616
1717/**
1818 * Session and Cookies must be used only in HTML Presentation layer.
19+ *
20+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921 */
2022class CookieAndSessionMisuse extends AbstractRule implements ClassAware
2123{
@@ -67,6 +69,19 @@ private function isLayoutProcessor(\ReflectionClass $class): bool
6769 );
6870 }
6971
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+
7085 /**
7186 * Is given class an HTML UI Document?
7287 *
@@ -191,6 +206,7 @@ public function apply(AbstractNode $node)
191206 && !$ this ->isControllerPlugin ($ class )
192207 && !$ this ->isBlockPlugin ($ class )
193208 && !$ this ->isLayoutProcessor ($ class )
209+ && !$ this ->isViewModel ($ class )
194210 ) {
195211 $ this ->addViolation ($ node , [$ node ->getFullQualifiedName ()]);
196212 }
You can’t perform that action at this time.
0 commit comments