From ef00afd073dbed5a43e36674ec9c3de847844687 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Mon, 13 Sep 2021 17:07:55 +0200 Subject: [PATCH 01/13] Fixed wrongly returning error for valid descriptions --- .../ClassPropertyPHPDocFormattingSniff.php | 38 +++++++++++-------- .../ClassPropertyPHPDocFormattingUnitTest.inc | 23 ++++++++++- .../ClassPropertyPHPDocFormattingUnitTest.php | 4 +- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 8ec509b4..18deeeff 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -112,10 +112,11 @@ public function processMemberVar(File $phpcsFile, $stackPtr) if ($varParts[1]) { return; } - $error = 'Short description duplicates class property name.'; - $phpcsFile->addWarning($error, $isShortDescriptionAfterVar, 'AlreadyHaveMeaningFulNameVar'); + $error = 'Short description must be before @var tag.'; + $phpcsFile->addWarning($error, $isShortDescriptionAfterVar, 'ShortDescriptionAfterVar'); return; } + // Check if class has already have meaningful description before @var tag $isShortDescriptionPreviousVar = $phpcsFile->findPrevious( T_DOC_COMMENT_STRING, @@ -125,23 +126,28 @@ public function processMemberVar(File $phpcsFile, $stackPtr) null, false ); - if ($this->PHPDocFormattingValidator->providesMeaning( - $isShortDescriptionPreviousVar, - $commentStart, - $tokens - ) !== true) { - preg_match( - '`^((?:\|?(?:array\([^\)]*\)|[\\\\\[\]]+))*)( .*)?`i', - $tokens[($foundVar + 2)]['content'], - $varParts - ); - if ($varParts[1]) { - return; - } + + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $tokens[$string]['content']) !== false) { $error = 'Short description duplicates class property name.'; - $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningFulNameVar'); + $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); return; } + $re = '/ + # Split camelCase "words". Two global alternatives. Either g1of2: + (?<=[a-z]) # Position is after a lowercase, + (?=[A-Z]) # and before an uppercase letter. + | (?<=[A-Z]) # Or g2of2; Position is after uppercase, + (?=[A-Z][a-z]) # and before upper-then-lower case. + /x'; + $varTagParts = preg_split($re, $tokens[$string]['content']); + + foreach ($varTagParts as $part) { + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $part) === false) { + return; + } + } + $error = 'Short description duplicates class property name.'; + $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } /** diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc index 6dcccf65..93339460 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc @@ -65,11 +65,25 @@ class Bar { private $variableName; /** - * Some more invalid description + * Some more invalid description with test which is the same name as the variable and is not allowed * * @var test */ protected $test; + + /** + * Formatted Correctly Protected Class Member + * + * @var correctlyFormattedProtectedClassMember + */ + protected $correctlyFormattedProtectedClassMember; + + /** + * anotherCorrectlyFormattedProtectedClassMember + * + * @var anotherCorrectlyFormattedProtectedClassMember + */ + protected $anotherCorrectlyFormattedProtectedClassMember; } class correctlyFormattedClassMemberDocBlock @@ -99,4 +113,11 @@ class correctlyFormattedClassMemberDocBlock * \FooObject_TEST_C */ private $testObject; + + /** + * Fallback factory + * + * @var RulePool + */ + protected $rulePool; } diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php index 5ce3f0d2..6686607b 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php @@ -32,7 +32,9 @@ public function getWarningList() 49 => 1, 56 => 1, 63 => 1, - 68 => 1 + 68 => 1, + 75 => 1, + 82 => 1, ]; } } From 95c56c9de1e426be89a042706f35876d9706e573 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:00:25 +0200 Subject: [PATCH 02/13] Update Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php Co-authored-by: Sergii Ivashchenko --- .../Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 18deeeff..08dc5c0a 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -132,7 +132,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr) $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); return; } - $re = '/ + $regularExpression = '/ # Split camelCase "words". Two global alternatives. Either g1of2: (?<=[a-z]) # Position is after a lowercase, (?=[A-Z]) # and before an uppercase letter. From 2a57af8e3db57f02518f90880358efe0b42d4dda Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:00:30 +0200 Subject: [PATCH 03/13] Update Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php Co-authored-by: Sergii Ivashchenko --- .../Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 08dc5c0a..492a1012 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -141,11 +141,9 @@ public function processMemberVar(File $phpcsFile, $stackPtr) /x'; $varTagParts = preg_split($re, $tokens[$string]['content']); - foreach ($varTagParts as $part) { - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $part) === false) { + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode(' ', $varTagParts)) === false) { return; } - } $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } From f209db6b754b9aaa6f665f67e6a8ba4e940f06a2 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:02:05 +0200 Subject: [PATCH 04/13] Fixed wrongly returning error for valid descriptions --- .../Commenting/ClassPropertyPHPDocFormattingSniff.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 492a1012..113da3e6 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -127,6 +127,10 @@ public function processMemberVar(File $phpcsFile, $stackPtr) false ); + if ($isShortDescriptionPreviousVar === false) { + return; + } + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $tokens[$string]['content']) !== false) { $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); @@ -139,7 +143,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr) | (?<=[A-Z]) # Or g2of2; Position is after uppercase, (?=[A-Z][a-z]) # and before upper-then-lower case. /x'; - $varTagParts = preg_split($re, $tokens[$string]['content']); + $varTagParts = preg_split($regularExpression, $tokens[$string]['content']); if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode(' ', $varTagParts)) === false) { return; From 1ed415620f31f914e590a113b3bfe7464e71d38e Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:06:46 +0200 Subject: [PATCH 05/13] Fixed wrongly returning error for valid descriptions --- .../Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php index 6686607b..7e8ecc91 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php @@ -33,7 +33,6 @@ public function getWarningList() 56 => 1, 63 => 1, 68 => 1, - 75 => 1, 82 => 1, ]; } From efaffacb5ff94f21c12ca529926ee2b81ba06906 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:12:01 +0200 Subject: [PATCH 06/13] Fixed wrongly returning error for valid descriptions --- .../Commenting/ClassPropertyPHPDocFormattingSniff.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 113da3e6..09d7afa9 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -131,11 +131,6 @@ public function processMemberVar(File $phpcsFile, $stackPtr) return; } - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $tokens[$string]['content']) !== false) { - $error = 'Short description duplicates class property name.'; - $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); - return; - } $regularExpression = '/ # Split camelCase "words". Two global alternatives. Either g1of2: (?<=[a-z]) # Position is after a lowercase, @@ -145,9 +140,9 @@ public function processMemberVar(File $phpcsFile, $stackPtr) /x'; $varTagParts = preg_split($regularExpression, $tokens[$string]['content']); - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode(' ', $varTagParts)) === false) { - return; - } + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $varTagParts)) === false) { + return; + } $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } From 62e0fc11dc03994fb290e6986b7724d536f3a4bf Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:25:05 +0200 Subject: [PATCH 07/13] Fixed wrongly returning error for valid descriptions --- Magento2/Sniffs/Classes/AbstractApiSniff.php | 2 +- Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php | 2 +- Magento2/Sniffs/Exceptions/DirectThrowSniff.php | 2 +- Magento2/Sniffs/Exceptions/ThrowCatchSniff.php | 2 +- Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php | 2 +- Magento2/Sniffs/Functions/StaticFunctionSniff.php | 2 +- Magento2/Sniffs/Legacy/MageEntitySniff.php | 2 +- Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php | 2 +- Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php | 2 +- Magento2/Sniffs/PHP/GotoSniff.php | 2 +- Magento2/Sniffs/PHP/ReturnValueCheckSniff.php | 4 +--- Magento2/Sniffs/PHP/VarSniff.php | 2 +- Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php | 2 +- Magento2/Sniffs/SQL/RawQuerySniff.php | 2 +- Magento2/Sniffs/Security/LanguageConstructSniff.php | 4 ++-- Magento2/Sniffs/Security/SuperglobalSniff.php | 4 ++-- Magento2/Sniffs/Security/XssTemplateSniff.php | 2 +- Magento2/Sniffs/Strings/ExecutableRegExSniff.php | 2 +- Magento2/Sniffs/Strings/StringConcatSniff.php | 2 +- Magento2/Sniffs/Templates/ThisInTemplateSniff.php | 4 ++-- Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php | 2 +- 21 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index bb8a6571..3f709b70 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -15,7 +15,7 @@ class AbstractApiSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php index f5e45c63..8f82ff74 100644 --- a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php +++ b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php @@ -18,7 +18,7 @@ class DiscouragedDependenciesSniff implements Sniff const CONSTRUCT_METHOD_NAME = '__construct'; /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php index 622644bf..60140afb 100644 --- a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php +++ b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php @@ -14,7 +14,7 @@ class DirectThrowSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * phpcs:disable Generic.Files.LineLength.TooLong * @var string */ diff --git a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php index c2510168..6497d47c 100644 --- a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php +++ b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php @@ -16,7 +16,7 @@ class ThrowCatchSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php index 0fa28149..49ddcf33 100644 --- a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php +++ b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php @@ -15,7 +15,7 @@ class TryProcessSystemResourcesSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Functions/StaticFunctionSniff.php b/Magento2/Sniffs/Functions/StaticFunctionSniff.php index 2ae706d0..b74683a9 100644 --- a/Magento2/Sniffs/Functions/StaticFunctionSniff.php +++ b/Magento2/Sniffs/Functions/StaticFunctionSniff.php @@ -14,7 +14,7 @@ class StaticFunctionSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Legacy/MageEntitySniff.php b/Magento2/Sniffs/Legacy/MageEntitySniff.php index de8b7dbf..ad334cec 100644 --- a/Magento2/Sniffs/Legacy/MageEntitySniff.php +++ b/Magento2/Sniffs/Legacy/MageEntitySniff.php @@ -14,7 +14,7 @@ class MageEntitySniff implements Sniff { /** - * String representation of error. + * Representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php index f094c353..8e68b35a 100644 --- a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php +++ b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php @@ -16,7 +16,7 @@ class DeprecatedModelMethodSniff implements Sniff const RESOURCE_METHOD = "getResource"; /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php index 2ad688ec..b04da011 100644 --- a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php +++ b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php @@ -14,7 +14,7 @@ class InterfaceNameSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/PHP/GotoSniff.php b/Magento2/Sniffs/PHP/GotoSniff.php index 4a5f06ca..0b74e855 100644 --- a/Magento2/Sniffs/PHP/GotoSniff.php +++ b/Magento2/Sniffs/PHP/GotoSniff.php @@ -14,7 +14,7 @@ class GotoSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php index 9929d46b..5a6d507f 100644 --- a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php +++ b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php @@ -14,7 +14,7 @@ class ReturnValueCheckSniff implements Sniff { /** - * String representation of error. + * Representation of error. * * @var string */ @@ -46,8 +46,6 @@ class ReturnValueCheckSniff implements Sniff protected $tokens = []; /** - * PHP_CodeSniffer file. - * * @var File */ protected $file; diff --git a/Magento2/Sniffs/PHP/VarSniff.php b/Magento2/Sniffs/PHP/VarSniff.php index fa7b28b7..dfa9bdee 100644 --- a/Magento2/Sniffs/PHP/VarSniff.php +++ b/Magento2/Sniffs/PHP/VarSniff.php @@ -14,7 +14,7 @@ class VarSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php index 9ab6c8cc..5e701bd7 100644 --- a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php +++ b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php @@ -14,7 +14,7 @@ class ForeachArrayMergeSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/SQL/RawQuerySniff.php b/Magento2/Sniffs/SQL/RawQuerySniff.php index a32d4eb0..966e90ea 100644 --- a/Magento2/Sniffs/SQL/RawQuerySniff.php +++ b/Magento2/Sniffs/SQL/RawQuerySniff.php @@ -15,7 +15,7 @@ class RawQuerySniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Security/LanguageConstructSniff.php b/Magento2/Sniffs/Security/LanguageConstructSniff.php index 9b10ae4a..f6ea2be2 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -14,14 +14,14 @@ class LanguageConstructSniff implements Sniff { /** - * String representation of error. + * Representation of error. * * @var string */ protected $errorMessage = 'Use of %s language construct is discouraged.'; /** - * String representation of backtick error. + * Representation of backtick error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Security/SuperglobalSniff.php b/Magento2/Sniffs/Security/SuperglobalSniff.php index 136f991f..7a30a3aa 100644 --- a/Magento2/Sniffs/Security/SuperglobalSniff.php +++ b/Magento2/Sniffs/Security/SuperglobalSniff.php @@ -14,14 +14,14 @@ class SuperglobalSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ protected $warningMessage = 'Direct use of %s Superglobal detected.'; /** - * String representation of error. + * Representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Security/XssTemplateSniff.php b/Magento2/Sniffs/Security/XssTemplateSniff.php index f35943e5..eabff249 100644 --- a/Magento2/Sniffs/Security/XssTemplateSniff.php +++ b/Magento2/Sniffs/Security/XssTemplateSniff.php @@ -14,7 +14,7 @@ class XssTemplateSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php index 09706ed6..769a176c 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -15,7 +15,7 @@ class ExecutableRegExSniff implements Sniff { /** - * String representation of error. + * Representation of error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Strings/StringConcatSniff.php b/Magento2/Sniffs/Strings/StringConcatSniff.php index 89c8dc9b..f409f421 100644 --- a/Magento2/Sniffs/Strings/StringConcatSniff.php +++ b/Magento2/Sniffs/Strings/StringConcatSniff.php @@ -15,7 +15,7 @@ class StringConcatSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php index 9b5e5358..45b4ebad 100644 --- a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php +++ b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php @@ -21,7 +21,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundHelper = 'FoundHelper'; /** - * String representation of warning. + * Representation of warning. * * @var string */ @@ -35,7 +35,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundThis = 'FoundThis'; /** - * String representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php index 4d74a29e..12bdc263 100644 --- a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php +++ b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php @@ -14,7 +14,7 @@ class MultipleEmptyLinesSniff implements Sniff { /** - * String representation of warning. + * Representation of warning. * * @var string */ From 5b4b543da950ec3c29ac41890c48ee302430cf87 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:28:54 +0200 Subject: [PATCH 08/13] Fixed wrongly returning error for valid descriptions --- Magento2/Sniffs/Classes/AbstractApiSniff.php | 2 +- Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php | 2 +- Magento2/Sniffs/Exceptions/DirectThrowSniff.php | 2 +- Magento2/Sniffs/Exceptions/ThrowCatchSniff.php | 2 +- Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php | 2 +- Magento2/Sniffs/Functions/StaticFunctionSniff.php | 2 +- Magento2/Sniffs/Legacy/MageEntitySniff.php | 2 +- Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php | 2 +- Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php | 2 +- Magento2/Sniffs/SQL/RawQuerySniff.php | 2 +- Magento2/Sniffs/Security/LanguageConstructSniff.php | 4 ++-- Magento2/Sniffs/Security/SuperglobalSniff.php | 4 ++-- Magento2/Sniffs/Security/XssTemplateSniff.php | 4 +--- Magento2/Sniffs/Strings/ExecutableRegExSniff.php | 2 +- Magento2/Sniffs/Strings/StringConcatSniff.php | 2 +- Magento2/Sniffs/Templates/ThisInTemplateSniff.php | 4 ++-- Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php | 2 +- 17 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index 3f709b70..a32dc0f5 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -15,7 +15,7 @@ class AbstractApiSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php index 8f82ff74..8996131f 100644 --- a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php +++ b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php @@ -18,7 +18,7 @@ class DiscouragedDependenciesSniff implements Sniff const CONSTRUCT_METHOD_NAME = '__construct'; /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php index 60140afb..1c74f63a 100644 --- a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php +++ b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php @@ -14,7 +14,7 @@ class DirectThrowSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * phpcs:disable Generic.Files.LineLength.TooLong * @var string */ diff --git a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php index 6497d47c..5c2efbcc 100644 --- a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php +++ b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php @@ -16,7 +16,7 @@ class ThrowCatchSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php index 49ddcf33..6d714dcc 100644 --- a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php +++ b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php @@ -15,7 +15,7 @@ class TryProcessSystemResourcesSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Functions/StaticFunctionSniff.php b/Magento2/Sniffs/Functions/StaticFunctionSniff.php index b74683a9..0805e3ce 100644 --- a/Magento2/Sniffs/Functions/StaticFunctionSniff.php +++ b/Magento2/Sniffs/Functions/StaticFunctionSniff.php @@ -14,7 +14,7 @@ class StaticFunctionSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Legacy/MageEntitySniff.php b/Magento2/Sniffs/Legacy/MageEntitySniff.php index ad334cec..8e305345 100644 --- a/Magento2/Sniffs/Legacy/MageEntitySniff.php +++ b/Magento2/Sniffs/Legacy/MageEntitySniff.php @@ -14,7 +14,7 @@ class MageEntitySniff implements Sniff { /** - * Representation of error. + * Representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php index 8e68b35a..cf58267f 100644 --- a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php +++ b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php @@ -16,7 +16,7 @@ class DeprecatedModelMethodSniff implements Sniff const RESOURCE_METHOD = "getResource"; /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php index 5e701bd7..09bc0bdd 100644 --- a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php +++ b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php @@ -14,7 +14,7 @@ class ForeachArrayMergeSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/SQL/RawQuerySniff.php b/Magento2/Sniffs/SQL/RawQuerySniff.php index 966e90ea..cb27c570 100644 --- a/Magento2/Sniffs/SQL/RawQuerySniff.php +++ b/Magento2/Sniffs/SQL/RawQuerySniff.php @@ -15,7 +15,7 @@ class RawQuerySniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Security/LanguageConstructSniff.php b/Magento2/Sniffs/Security/LanguageConstructSniff.php index f6ea2be2..a8e1c979 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -14,14 +14,14 @@ class LanguageConstructSniff implements Sniff { /** - * Representation of error. + * Representation of error. * * @var string */ protected $errorMessage = 'Use of %s language construct is discouraged.'; /** - * Representation of backtick error. + * Representation of backtick error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Security/SuperglobalSniff.php b/Magento2/Sniffs/Security/SuperglobalSniff.php index 7a30a3aa..4d029dfc 100644 --- a/Magento2/Sniffs/Security/SuperglobalSniff.php +++ b/Magento2/Sniffs/Security/SuperglobalSniff.php @@ -14,14 +14,14 @@ class SuperglobalSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ protected $warningMessage = 'Direct use of %s Superglobal detected.'; /** - * Representation of error. + * Representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Security/XssTemplateSniff.php b/Magento2/Sniffs/Security/XssTemplateSniff.php index eabff249..490d5cbd 100644 --- a/Magento2/Sniffs/Security/XssTemplateSniff.php +++ b/Magento2/Sniffs/Security/XssTemplateSniff.php @@ -14,7 +14,7 @@ class XssTemplateSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ @@ -85,8 +85,6 @@ class XssTemplateSniff implements Sniff private $statements = []; /** - * PHP_CodeSniffer file. - * * @var File */ private $file; diff --git a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php index 769a176c..5e435322 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -15,7 +15,7 @@ class ExecutableRegExSniff implements Sniff { /** - * Representation of error. + * Representation of error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Strings/StringConcatSniff.php b/Magento2/Sniffs/Strings/StringConcatSniff.php index f409f421..06eb6a27 100644 --- a/Magento2/Sniffs/Strings/StringConcatSniff.php +++ b/Magento2/Sniffs/Strings/StringConcatSniff.php @@ -15,7 +15,7 @@ class StringConcatSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php index 45b4ebad..afedc43f 100644 --- a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php +++ b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php @@ -21,7 +21,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundHelper = 'FoundHelper'; /** - * Representation of warning. + * Representation of warning. * * @var string */ @@ -35,7 +35,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundThis = 'FoundThis'; /** - * Representation of warning. + * Representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php index 12bdc263..d5152da3 100644 --- a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php +++ b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php @@ -14,7 +14,7 @@ class MultipleEmptyLinesSniff implements Sniff { /** - * Representation of warning. + * Representation of warning. * * @var string */ From 0c29f5b65a149dff8c991b1e9afebd9826ff1c8b Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 09:32:23 +0200 Subject: [PATCH 09/13] Fixed wrongly returning error for valid descriptions --- .../Commenting/ClassPropertyPHPDocFormattingSniff.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 09d7afa9..0c08e5ef 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -140,11 +140,10 @@ public function processMemberVar(File $phpcsFile, $stackPtr) /x'; $varTagParts = preg_split($regularExpression, $tokens[$string]['content']); - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $varTagParts)) === false) { - return; + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $varTagParts)) !== false) { + $error = 'Short description duplicates class property name.'; + $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } - $error = 'Short description duplicates class property name.'; - $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } /** From 3fb9cbae028a770b467fc6d8e2833ccdea81c0ac Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 10:09:36 +0200 Subject: [PATCH 10/13] Fixed wrongly returning error for valid descriptions --- .../ClassPropertyPHPDocFormattingSniff.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 0c08e5ef..7b418435 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -131,16 +131,21 @@ public function processMemberVar(File $phpcsFile, $stackPtr) return; } - $regularExpression = '/ - # Split camelCase "words". Two global alternatives. Either g1of2: - (?<=[a-z]) # Position is after a lowercase, - (?=[A-Z]) # and before an uppercase letter. - | (?<=[A-Z]) # Or g2of2; Position is after uppercase, - (?=[A-Z][a-z]) # and before upper-then-lower case. - /x'; - $varTagParts = preg_split($regularExpression, $tokens[$string]['content']); - - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $varTagParts)) !== false) { + $propertyNamePosition = $phpcsFile->findNext( + T_VARIABLE, + $foundVar, + null, + false, + null, + false + ); + if ($propertyNamePosition === false) { + return; + }; + $propertyName = trim($tokens[$propertyNamePosition]['content'], '$'); + $propertyNameParts = array_filter(preg_split('/(?=[A-Z])/', $propertyName)); + + if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $propertyNameParts)) !== false) { $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } From d238849c5c59bc07c7f37df89018ebe14612b74a Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 10:33:48 +0200 Subject: [PATCH 11/13] Fixed wrongly returning error for valid descriptions --- .../ClassPropertyPHPDocFormattingSniff.php | 9 ++++++++- .../ClassPropertyPHPDocFormattingUnitTest.inc | 16 ++++++++-------- .../ClassPropertyPHPDocFormattingUnitTest.php | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 7b418435..45f3276c 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -143,9 +143,16 @@ public function processMemberVar(File $phpcsFile, $stackPtr) return; }; $propertyName = trim($tokens[$propertyNamePosition]['content'], '$'); + + if (strtolower($tokens[$isShortDescriptionPreviousVar]['content']) === strtolower($propertyName)) { + $error = 'Short description duplicates class property name.'; + $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); + return; + } + $propertyNameParts = array_filter(preg_split('/(?=[A-Z])/', $propertyName)); - if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode('', $propertyNameParts)) !== false) { + if (strtolower($tokens[$isShortDescriptionPreviousVar]['content']) === strtolower(implode(' ', $propertyNameParts))) { $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc index 93339460..05f9cd13 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc @@ -65,14 +65,7 @@ class Bar { private $variableName; /** - * Some more invalid description with test which is the same name as the variable and is not allowed - * - * @var test - */ - protected $test; - - /** - * Formatted Correctly Protected Class Member + * Correctly Formatted Protected Class Member * * @var correctlyFormattedProtectedClassMember */ @@ -120,4 +113,11 @@ class correctlyFormattedClassMemberDocBlock * @var RulePool */ protected $rulePool; + + /** + * A description that includes test which is the same name as the variable is allowed + * + * @var test + */ + protected $test; } diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php index 7e8ecc91..6a49be76 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php @@ -33,7 +33,7 @@ public function getWarningList() 56 => 1, 63 => 1, 68 => 1, - 82 => 1, + 75 => 1, ]; } } From e92e17db5e3eae31dc258cbe2ed0ac8f6a36df19 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 10:39:15 +0200 Subject: [PATCH 12/13] Fixed wrongly returning error for valid descriptions --- .../Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 45f3276c..34cb7dd3 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -143,8 +143,9 @@ public function processMemberVar(File $phpcsFile, $stackPtr) return; }; $propertyName = trim($tokens[$propertyNamePosition]['content'], '$'); + $shortDescription = strtolower($tokens[$isShortDescriptionPreviousVar]['content']); - if (strtolower($tokens[$isShortDescriptionPreviousVar]['content']) === strtolower($propertyName)) { + if ($shortDescription === strtolower($propertyName)) { $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); return; @@ -152,7 +153,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr) $propertyNameParts = array_filter(preg_split('/(?=[A-Z])/', $propertyName)); - if (strtolower($tokens[$isShortDescriptionPreviousVar]['content']) === strtolower(implode(' ', $propertyNameParts))) { + if ($shortDescription === strtolower(implode(' ', $propertyNameParts))) { $error = 'Short description duplicates class property name.'; $phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar'); } From 0fb55fcc54a77bc207ed0aaebf7b77b514e870b5 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Tue, 14 Sep 2021 10:45:50 +0200 Subject: [PATCH 13/13] Fixed wrongly returning error for valid descriptions --- Magento2/Sniffs/Classes/AbstractApiSniff.php | 2 +- Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php | 2 +- Magento2/Sniffs/Exceptions/DirectThrowSniff.php | 2 +- Magento2/Sniffs/Exceptions/ThrowCatchSniff.php | 2 +- Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php | 2 +- Magento2/Sniffs/Functions/StaticFunctionSniff.php | 2 +- Magento2/Sniffs/Legacy/MageEntitySniff.php | 2 +- Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php | 2 +- Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php | 2 +- Magento2/Sniffs/PHP/GotoSniff.php | 2 +- Magento2/Sniffs/PHP/ReturnValueCheckSniff.php | 4 +++- Magento2/Sniffs/PHP/VarSniff.php | 2 +- Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php | 2 +- Magento2/Sniffs/SQL/RawQuerySniff.php | 2 +- Magento2/Sniffs/Security/LanguageConstructSniff.php | 4 ++-- Magento2/Sniffs/Security/SuperglobalSniff.php | 4 ++-- Magento2/Sniffs/Security/XssTemplateSniff.php | 4 +++- Magento2/Sniffs/Strings/ExecutableRegExSniff.php | 2 +- Magento2/Sniffs/Strings/StringConcatSniff.php | 2 +- Magento2/Sniffs/Templates/ThisInTemplateSniff.php | 4 ++-- Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php | 2 +- 21 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index a32dc0f5..bb8a6571 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -15,7 +15,7 @@ class AbstractApiSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php index 8996131f..f5e45c63 100644 --- a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php +++ b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php @@ -18,7 +18,7 @@ class DiscouragedDependenciesSniff implements Sniff const CONSTRUCT_METHOD_NAME = '__construct'; /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php index 1c74f63a..622644bf 100644 --- a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php +++ b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php @@ -14,7 +14,7 @@ class DirectThrowSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * phpcs:disable Generic.Files.LineLength.TooLong * @var string */ diff --git a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php index 5c2efbcc..c2510168 100644 --- a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php +++ b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php @@ -16,7 +16,7 @@ class ThrowCatchSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php index 6d714dcc..0fa28149 100644 --- a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php +++ b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php @@ -15,7 +15,7 @@ class TryProcessSystemResourcesSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Functions/StaticFunctionSniff.php b/Magento2/Sniffs/Functions/StaticFunctionSniff.php index 0805e3ce..2ae706d0 100644 --- a/Magento2/Sniffs/Functions/StaticFunctionSniff.php +++ b/Magento2/Sniffs/Functions/StaticFunctionSniff.php @@ -14,7 +14,7 @@ class StaticFunctionSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Legacy/MageEntitySniff.php b/Magento2/Sniffs/Legacy/MageEntitySniff.php index 8e305345..de8b7dbf 100644 --- a/Magento2/Sniffs/Legacy/MageEntitySniff.php +++ b/Magento2/Sniffs/Legacy/MageEntitySniff.php @@ -14,7 +14,7 @@ class MageEntitySniff implements Sniff { /** - * Representation of error. + * String representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php index cf58267f..f094c353 100644 --- a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php +++ b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php @@ -16,7 +16,7 @@ class DeprecatedModelMethodSniff implements Sniff const RESOURCE_METHOD = "getResource"; /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php index b04da011..2ad688ec 100644 --- a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php +++ b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php @@ -14,7 +14,7 @@ class InterfaceNameSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/PHP/GotoSniff.php b/Magento2/Sniffs/PHP/GotoSniff.php index 0b74e855..4a5f06ca 100644 --- a/Magento2/Sniffs/PHP/GotoSniff.php +++ b/Magento2/Sniffs/PHP/GotoSniff.php @@ -14,7 +14,7 @@ class GotoSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php index 5a6d507f..9929d46b 100644 --- a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php +++ b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php @@ -14,7 +14,7 @@ class ReturnValueCheckSniff implements Sniff { /** - * Representation of error. + * String representation of error. * * @var string */ @@ -46,6 +46,8 @@ class ReturnValueCheckSniff implements Sniff protected $tokens = []; /** + * PHP_CodeSniffer file. + * * @var File */ protected $file; diff --git a/Magento2/Sniffs/PHP/VarSniff.php b/Magento2/Sniffs/PHP/VarSniff.php index dfa9bdee..fa7b28b7 100644 --- a/Magento2/Sniffs/PHP/VarSniff.php +++ b/Magento2/Sniffs/PHP/VarSniff.php @@ -14,7 +14,7 @@ class VarSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php index 09bc0bdd..9ab6c8cc 100644 --- a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php +++ b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php @@ -14,7 +14,7 @@ class ForeachArrayMergeSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/SQL/RawQuerySniff.php b/Magento2/Sniffs/SQL/RawQuerySniff.php index cb27c570..a32d4eb0 100644 --- a/Magento2/Sniffs/SQL/RawQuerySniff.php +++ b/Magento2/Sniffs/SQL/RawQuerySniff.php @@ -15,7 +15,7 @@ class RawQuerySniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Security/LanguageConstructSniff.php b/Magento2/Sniffs/Security/LanguageConstructSniff.php index a8e1c979..9b10ae4a 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -14,14 +14,14 @@ class LanguageConstructSniff implements Sniff { /** - * Representation of error. + * String representation of error. * * @var string */ protected $errorMessage = 'Use of %s language construct is discouraged.'; /** - * Representation of backtick error. + * String representation of backtick error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Security/SuperglobalSniff.php b/Magento2/Sniffs/Security/SuperglobalSniff.php index 4d029dfc..136f991f 100644 --- a/Magento2/Sniffs/Security/SuperglobalSniff.php +++ b/Magento2/Sniffs/Security/SuperglobalSniff.php @@ -14,14 +14,14 @@ class SuperglobalSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ protected $warningMessage = 'Direct use of %s Superglobal detected.'; /** - * Representation of error. + * String representation of error. * * @var string */ diff --git a/Magento2/Sniffs/Security/XssTemplateSniff.php b/Magento2/Sniffs/Security/XssTemplateSniff.php index 490d5cbd..f35943e5 100644 --- a/Magento2/Sniffs/Security/XssTemplateSniff.php +++ b/Magento2/Sniffs/Security/XssTemplateSniff.php @@ -14,7 +14,7 @@ class XssTemplateSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ @@ -85,6 +85,8 @@ class XssTemplateSniff implements Sniff private $statements = []; /** + * PHP_CodeSniffer file. + * * @var File */ private $file; diff --git a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php index 5e435322..09706ed6 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -15,7 +15,7 @@ class ExecutableRegExSniff implements Sniff { /** - * Representation of error. + * String representation of error. * * phpcs:disable Generic.Files.LineLength * diff --git a/Magento2/Sniffs/Strings/StringConcatSniff.php b/Magento2/Sniffs/Strings/StringConcatSniff.php index 06eb6a27..89c8dc9b 100644 --- a/Magento2/Sniffs/Strings/StringConcatSniff.php +++ b/Magento2/Sniffs/Strings/StringConcatSniff.php @@ -15,7 +15,7 @@ class StringConcatSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php index afedc43f..9b5e5358 100644 --- a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php +++ b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php @@ -21,7 +21,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundHelper = 'FoundHelper'; /** - * Representation of warning. + * String representation of warning. * * @var string */ @@ -35,7 +35,7 @@ class ThisInTemplateSniff implements Sniff protected $warningCodeFoundThis = 'FoundThis'; /** - * Representation of warning. + * String representation of warning. * * @var string */ diff --git a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php index d5152da3..4d74a29e 100644 --- a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php +++ b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php @@ -14,7 +14,7 @@ class MultipleEmptyLinesSniff implements Sniff { /** - * Representation of warning. + * String representation of warning. * * @var string */