diff --git a/Magento2/Sniffs/Legacy/CopyrightAnotherExtensionsFilesSniff.php b/Magento2/Sniffs/Legacy/CopyrightAnotherExtensionsFilesSniff.php index 1455ee58..a1d6995b 100644 --- a/Magento2/Sniffs/Legacy/CopyrightAnotherExtensionsFilesSniff.php +++ b/Magento2/Sniffs/Legacy/CopyrightAnotherExtensionsFilesSniff.php @@ -7,6 +7,7 @@ namespace Magento2\Sniffs\Legacy; +use Magento2\Sniffs\Less\TokenizerSymbolsInterface; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; @@ -16,6 +17,13 @@ class CopyrightAnotherExtensionsFilesSniff implements Sniff private const COPYRIGHT_MAGENTO_TEXT = 'Copyright © Magento, Inc. All rights reserved.'; private const COPYRIGHT_ADOBE = '/Copyright \d+ Adobe/'; + + /** + * Defines the tokenizers that this sniff is using. + * + * @var array + */ + public $supportedTokenizers = [TokenizerSymbolsInterface::TOKENIZER_CSS, 'PHP']; /** * @inheritDoc @@ -23,7 +31,8 @@ class CopyrightAnotherExtensionsFilesSniff implements Sniff public function register(): array { return [ - T_INLINE_HTML + T_INLINE_HTML, + T_OPEN_TAG ]; } diff --git a/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.xml b/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.3.xml similarity index 100% rename from Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.xml rename to Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.3.xml diff --git a/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.5.less b/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.5.less new file mode 100644 index 00000000..a86154e6 --- /dev/null +++ b/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.5.less @@ -0,0 +1,8 @@ +/** + * Copyright © Magento, Inc. + * See COPYING.txt for license details. + */ + +//@magento_import "magento_import.less"; +@import "dir/import.less"; + diff --git a/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.php b/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.php index 8796abb9..4223e600 100644 --- a/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.php +++ b/Magento2/Tests/Legacy/CopyrightAnotherExtensionsFilesUnitTest.php @@ -36,6 +36,11 @@ public function getWarningList($testFile = '') if ($testFile === 'CopyrightAnotherExtensionsFilesUnitTest.4.js') { return []; } + if ($testFile === 'CopyrightAnotherExtensionsFilesUnitTest.5.less') { + return [ + null => 1, + ]; + } return []; } }