Skip to content

Commit 4ae79be

Browse files
committed
Merge branch 'MC-19064' into hb-pr-branch
2 parents 5351c27 + e085e1b commit 4ae79be

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/CookieAndSessionMisuse.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* Session and Cookies must be used only in HTML Presentation layer.
19+
*
20+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921
*/
2022
class 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
}

0 commit comments

Comments
 (0)