Skip to content

Commit 1798cf4

Browse files
committed
Fix PHP error with short class names
1 parent 0263b89 commit 1798cf4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Magento2/Sniffs/Less/ClassNamingSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public function process(File $phpcsFile, $stackPtr)
6666
[implode("", $matches[0])]
6767
);
6868
}
69-
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
69+
70+
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
7071
$phpcsFile->addError(
7172
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
7273
$stackPtr,

Magento2/Tests/Less/ClassNamingUnitTest.less

+5
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@
3030
.category-title {
3131
background: green;
3232
}
33+
34+
// @see https://github.com/magento/magento-coding-standard/issues/425
35+
.a {
36+
text-decoration: none;
37+
}

0 commit comments

Comments
 (0)