diff --git a/Magento2/Sniffs/Legacy/CodingStandardsIgnoreAnnotationUsageSniff.php b/Magento2/Sniffs/Legacy/CodingStandardsIgnoreAnnotationUsageSniff.php new file mode 100644 index 00000000..338fc1aa --- /dev/null +++ b/Magento2/Sniffs/Legacy/CodingStandardsIgnoreAnnotationUsageSniff.php @@ -0,0 +1,47 @@ +getTokens(); + + if (strpos($tokens[$stackPtr - 1]['content'], self::CODING_STANDARDS_IGNORE_FILE) !== false) { + $phpcsFile->addWarning( + self::WARNING_MESSAGE . $phpcsFile->getFilename(), + $stackPtr, + self::WARNING_CODE + ); + } + } +} diff --git a/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.inc b/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.inc new file mode 100644 index 00000000..2ee18131 --- /dev/null +++ b/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.inc @@ -0,0 +1,37 @@ +randomNumber = random_int(0, 999); + } + + /** + * @return int + */ + public function getRandomNumber(): int + { + return $this->randomNumber; + } + + /** + * @param int $randomNumber + */ + public function setRandomNumber(int $randomNumber): void + { + $this->randomNumber = $randomNumber; + } +} diff --git a/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.php b/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.php new file mode 100644 index 00000000..ac9caece --- /dev/null +++ b/Magento2/Tests/Legacy/CodingStandardsIgnoreAnnotationUsageUnitTest.php @@ -0,0 +1,26 @@ + 1 + ]; + } +} diff --git a/Magento2/ruleset.xml b/Magento2/ruleset.xml index f31b105d..92ff8ac2 100644 --- a/Magento2/ruleset.xml +++ b/Magento2/ruleset.xml @@ -111,6 +111,10 @@ + + 9 + warning + 9 warning