Skip to content

Commit

Permalink
Merge pull request #205 from magento-commerce/imported-fredden-magent…
Browse files Browse the repository at this point in the history
…o-coding-standard-426

[Imported] Fix PHP error with short class names
  • Loading branch information
sidolov authored Mar 28, 2023
2 parents 5f4cb84 + 5a852b3 commit 94041d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Magento2/Sniffs/Less/ClassNamingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function process(File $phpcsFile, $stackPtr)
);
}

if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
&& !str_starts_with($className, 'admin__')
) {
$phpcsFile->addError(
Expand Down
5 changes: 5 additions & 0 deletions Magento2/Tests/Less/ClassNamingUnitTest.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
background: green;
}

// @see https://github.com/magento/magento-coding-standard/issues/425
.a {
text-decoration: none;
}

// @see https://github.com/magento/magento-coding-standard/issues/409
.admin__allowed {
background: green;
Expand Down

0 comments on commit 94041d7

Please sign in to comment.