Skip to content

Commit f209db6

Browse files
committed
Fixed wrongly returning error for valid descriptions
1 parent 2a57af8 commit f209db6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
127127
false
128128
);
129129

130+
if ($isShortDescriptionPreviousVar === false) {
131+
return;
132+
}
133+
130134
if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], $tokens[$string]['content']) !== false) {
131135
$error = 'Short description duplicates class property name.';
132136
$phpcsFile->addWarning($error, $isShortDescriptionPreviousVar, 'AlreadyHaveMeaningfulNameVar');
@@ -139,7 +143,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
139143
| (?<=[A-Z]) # Or g2of2; Position is after uppercase,
140144
(?=[A-Z][a-z]) # and before upper-then-lower case.
141145
/x';
142-
$varTagParts = preg_split($re, $tokens[$string]['content']);
146+
$varTagParts = preg_split($regularExpression, $tokens[$string]['content']);
143147

144148
if (stripos($tokens[$isShortDescriptionPreviousVar]['content'], implode(' ', $varTagParts)) === false) {
145149
return;

0 commit comments

Comments
 (0)