Skip to content

Commit 06a96f8

Browse files
committedApr 30, 2024
ACP2E-2977: Implement Static test which will check for no usage of object manager in .phtml files
1 parent 81676df commit 06a96f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

Diff for: ‎Magento2/Sniffs/Phtml/PhtmlTemplateObjectManagerSniff.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ public function process(File $phpcsFile, $stackPtr)
5555
}
5656

5757
$phpcsFile->addWarning(
58-
'ObjectManager should not be used in .phtml template ' .
59-
'as it\'s not a template\'s responsibility to create objects.',
58+
'ObjectManager should not be used in .phtml template. ' .
59+
'Templates must not instantiate new objects within their code. ' .
60+
'All objects must be passed from the Block object.',
6061
$stackPtr,
6162
self::WARNING_CODE_OBJECT_MANAGER_USAGE
6263
);

0 commit comments

Comments
 (0)