diff --git a/Magento2/Sniffs/Less/ClassNamingSniff.php b/Magento2/Sniffs/Less/ClassNamingSniff.php index e684172b..babd0653 100644 --- a/Magento2/Sniffs/Less/ClassNamingSniff.php +++ b/Magento2/Sniffs/Less/ClassNamingSniff.php @@ -66,7 +66,10 @@ public function process(File $phpcsFile, $stackPtr) [implode("", $matches[0])] ); } - if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) { + + if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false + && !str_starts_with($className, 'admin__') + ) { $phpcsFile->addError( 'CSS class names should be separated with "-" (dash) instead of "_" (underscore)', $stackPtr, diff --git a/Magento2/Tests/Less/ClassNamingUnitTest.less b/Magento2/Tests/Less/ClassNamingUnitTest.less index ba60c205..bbb29cde 100644 --- a/Magento2/Tests/Less/ClassNamingUnitTest.less +++ b/Magento2/Tests/Less/ClassNamingUnitTest.less @@ -30,3 +30,8 @@ .category-title { background: green; } + +// @see https://github.com/magento/magento-coding-standard/issues/409 +.admin__allowed { + background: green; +} diff --git a/composer.json b/composer.json index fd6d43a7..8216e509 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "ext-dom": "*", "phpcompatibility/php-compatibility": "^9.3", "squizlabs/php_codesniffer": "^3.6.1", - "rector/rector": "^0.15.10" + "rector/rector": "^0.15.10", + "symfony/polyfill": "^1.16" }, "require-dev": { "phpunit/phpunit": "^9.5.8" diff --git a/composer.lock b/composer.lock index 23393d2e..af2c3b88 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d5b737bfcab2053b6a04725293a5abff", + "content-hash": "7281808f33bc1154ee5a0ec2a358847b", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -317,6 +317,123 @@ }, "time": "2022-06-18T07:21:10+00:00" }, + { + "name": "symfony/polyfill", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill.git", + "reference": "b78222a273aac3e5bab6358bf499d7f1fb88e48b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill/zipball/b78222a273aac3e5bab6358bf499d7f1fb88e48b", + "reference": "b78222a273aac3e5bab6358bf499d7f1fb88e48b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "replace": { + "symfony/polyfill-apcu": "self.version", + "symfony/polyfill-ctype": "self.version", + "symfony/polyfill-iconv": "self.version", + "symfony/polyfill-intl-grapheme": "self.version", + "symfony/polyfill-intl-icu": "self.version", + "symfony/polyfill-intl-idn": "self.version", + "symfony/polyfill-intl-messageformatter": "self.version", + "symfony/polyfill-intl-normalizer": "self.version", + "symfony/polyfill-mbstring": "self.version", + "symfony/polyfill-php72": "self.version", + "symfony/polyfill-php73": "self.version", + "symfony/polyfill-php74": "self.version", + "symfony/polyfill-php80": "self.version", + "symfony/polyfill-php81": "self.version", + "symfony/polyfill-php82": "self.version", + "symfony/polyfill-php83": "self.version", + "symfony/polyfill-util": "self.version", + "symfony/polyfill-uuid": "self.version", + "symfony/polyfill-xml": "self.version" + }, + "require-dev": { + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/phpunit-bridge": "^5.3|^6.0", + "symfony/var-dumper": "^4.4|^5.1|^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + } + }, + "autoload": { + "files": [ + "src/bootstrap.php", + "src/Apcu/bootstrap.php", + "src/Ctype/bootstrap.php", + "src/Uuid/bootstrap.php", + "src/Iconv/bootstrap.php", + "src/Intl/Grapheme/bootstrap.php", + "src/Intl/Idn/bootstrap.php", + "src/Intl/Icu/bootstrap.php", + "src/Intl/MessageFormatter/bootstrap.php", + "src/Intl/Normalizer/bootstrap.php", + "src/Mbstring/bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\": "src/" + }, + "classmap": [ + "src/Intl/Icu/Resources/stubs", + "src/Intl/MessageFormatter/Resources/stubs", + "src/Intl/Normalizer/Resources/stubs", + "src/Php82/Resources/stubs", + "src/Php80/Resources/stubs", + "src/Php73/Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfills backporting features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "support": { + "issues": "https://github.com/symfony/polyfill/issues", + "source": "https://github.com/symfony/polyfill/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-10T10:11:03+00:00" + }, { "name": "webonyx/graphql-php", "version": "v15.0.0",