diff --git a/Magento2/Sniffs/Less/SemicolonSpacingSniff.php b/Magento2/Sniffs/Less/SemicolonSpacingSniff.php index cad13290..5acc7d2e 100644 --- a/Magento2/Sniffs/Less/SemicolonSpacingSniff.php +++ b/Magento2/Sniffs/Less/SemicolonSpacingSniff.php @@ -83,7 +83,7 @@ private function validateSemicolon(File $phpcsFile, $stackPtr, array $tokens, $s { if ((false === $semicolonPtr || $tokens[$semicolonPtr]['line'] !== $tokens[$stackPtr]['line']) && (isset($tokens[$stackPtr - 1]) && !in_array($tokens[$stackPtr - 1]['code'], $this->styleCodesToSkip)) - && (T_COLON !== $tokens[$stackPtr + 1]['code']) + && (T_COLON !== $tokens[$stackPtr]['code']) ) { $error = 'Style definitions must end with a semicolon'; $phpcsFile->addError($error, $stackPtr, 'NotAtEnd'); diff --git a/Magento2/Tests/Less/SemicolonSpacingUnitTest.less b/Magento2/Tests/Less/SemicolonSpacingUnitTest.less new file mode 100644 index 00000000..4c621871 --- /dev/null +++ b/Magento2/Tests/Less/SemicolonSpacingUnitTest.less @@ -0,0 +1,13 @@ +// /** +// * Copyright © Magento, Inc. All rights reserved. +// * See COPYING.txt for license details. +// */ + +.nav { + background-color: green; +} + +.nav-list { + background-color: red ; + color: red +} diff --git a/Magento2/Tests/Less/SemicolonSpacingUnitTest.php b/Magento2/Tests/Less/SemicolonSpacingUnitTest.php new file mode 100644 index 00000000..e25e8d6d --- /dev/null +++ b/Magento2/Tests/Less/SemicolonSpacingUnitTest.php @@ -0,0 +1,28 @@ + 1, + 12 => 1 + ]; + } + + /** + * @inheritdoc + */ + public function getWarningList() + { + return []; + } +}