diff --git a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php index 3ba9e7c7..861f5d60 100644 --- a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php +++ b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento2\Helpers\Commenting; use PHP_CodeSniffer\Files\File; @@ -18,6 +19,7 @@ class PHPDocFormattingValidator * * @param int $startPtr * @param File $phpcsFile + * * @return int */ public function findPHPDoc($startPtr, $phpcsFile) @@ -53,6 +55,7 @@ public function findPHPDoc($startPtr, $phpcsFile) * @param int $namePtr * @param int $commentStartPtr * @param array $tokens + * * @return bool */ public function providesMeaning($namePtr, $commentStartPtr, $tokens) @@ -113,6 +116,7 @@ public function providesMeaning($namePtr, $commentStartPtr, $tokens) * * @param int $commentStartPtr * @param array $tokens + * * @return bool */ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens) @@ -129,6 +133,7 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens) )) { return true; } + return false; } @@ -141,6 +146,7 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens) * @param string $tag * @param int $commentStartPtr * @param array $tokens + * * @return int */ private function getTagPosition($tag, $commentStartPtr, $tokens) diff --git a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc index 2e0fdf0e..7c366bed 100644 --- a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc +++ b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc @@ -380,6 +380,16 @@ class MethodAnnotationFixture return false; } + /** + * This deprecated function is correct even though it only contains the @deprecated tag. + * + * @deprecated This method will be removed in version 123.45.6789 without replacement + */ + public function correctBecauseOfKeywordPhraseLongVersion() + { + return false; + } + /** * This deprecated function is correct even though it only contains the @deprecated tag. * @@ -389,4 +399,14 @@ class MethodAnnotationFixture { return false; } + + /** + * This deprecated function is correct even though it only contains the @deprecated tag. + * + * @deprecated WOW! This method will be removed in version 123.45.6789 without replacement + */ + public function alsoCorrectBecauseOfKeywordPhraseLongVersion() + { + return false; + } } diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc index 9c6af406..658c88a0 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc @@ -171,6 +171,14 @@ class DeprecatedButHandler } +/** + * @deprecated This class will be removed in version 123.45.6789 without replacement + */ +class DeprecatedButHandlerLongVersion +{ + +} + /** * @deprecated It's also deprecated - This class will be removed in version 1.0.0 without replacement */ @@ -179,6 +187,14 @@ class AlsoDeprecatedButHandler } +/** + * @deprecated It's also deprecated - This class will be removed in version 123.45.6789 without replacement + */ +class AlsoDeprecatedButHandlerLongVersion +{ + +} + /** * @package this tag should not be used */ diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc.fixed b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc.fixed index 33cbc544..3467adfc 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc.fixed +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc.fixed @@ -151,6 +151,14 @@ class DeprecatedButHandler } +/** + * @deprecated This class will be removed in version 123.45.6789 without replacement + */ +class DeprecatedButHandlerLongVersion +{ + +} + /** * @deprecated It's also deprecated - This class will be removed in version 1.0.0 without replacement */ @@ -159,6 +167,14 @@ class AlsoDeprecatedButHandler } +/** + * @deprecated It's also deprecated - This class will be removed in version 123.45.6789 without replacement + */ +class AlsoDeprecatedButHandlerLongVersion +{ + +} + class OnlyUselessCommentContent { diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc index 2abb26bf..7538de79 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc @@ -171,6 +171,14 @@ interface DeprecatedButHandler } +/** + * @deprecated This interface will be removed in version 123.45.6789 without replacement + */ +interface DeprecatedButHandlerLongVersion +{ + +} + /** * @deprecated Yeah! This interface will be removed in version 1.0.0 without replacement */ @@ -179,6 +187,14 @@ interface AlsoDeprecatedButHandler } +/** + * @deprecated Yeah! This interface will be removed in version 123.45.6789 without replacement + */ +interface AlsoDeprecatedButHandlerLongVersion +{ + +} + /** * @package this tag should not be used */ diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc.fixed b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc.fixed index f7cfcf21..4ea41705 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc.fixed +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc.fixed @@ -151,6 +151,14 @@ interface DeprecatedButHandler } +/** + * @deprecated This interface will be removed in version 123.45.6789 without replacement + */ +interface DeprecatedButHandlerLongVersion +{ + +} + /** * @deprecated Yeah! This interface will be removed in version 1.0.0 without replacement */ @@ -159,6 +167,14 @@ interface AlsoDeprecatedButHandler } +/** + * @deprecated Yeah! This interface will be removed in version 123.45.6789 without replacement + */ +interface AlsoDeprecatedButHandlerLongVersion +{ + +} + interface OnlyUselessCommentContent { diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php index b750b815..8e67c02f 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento2\Tests\Commenting; use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; @@ -37,7 +38,7 @@ public function getWarningList($testFile = '') 109 => 1, 118 => 1, 127 => 1, - 183 => 1, + 199 => 1, ]; } } diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc index aca8a73b..68a78e61 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc @@ -201,6 +201,12 @@ class correctlyFormattedClassMemberDocBlock */ protected string $deprecatedWithKeyword; + /** + * @var string + * @deprecated This property will be removed in version 123.45.6789 without replacement + */ + protected string $deprecatedWithKeywordLongVersion; + /** * @var string */ diff --git a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc index a751d8aa..34b7b073 100644 --- a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc +++ b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc @@ -69,8 +69,18 @@ class Profiler */ const KEYWORD_PHRASE = false; + /** + * @deprecated This constant will be removed in version 123.45.6789 without replacement + */ + const KEYWORD_PHRASE_LONG_VERSION = false; + /** * @deprecated It's awesome - This constant will be removed in version 1.0.0 without replacement */ const WITH_KEYWORD_PHRASE = false; + + /** + * @deprecated It's awesome - This constant will be removed in version 123.45.6789 without replacement + */ + const WITH_KEYWORD_PHRASE_LONG_VERSION = false; }