File tree 3 files changed +17
-10
lines changed
3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -143,9 +143,16 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
143
143
return ;
144
144
};
145
145
$ propertyName = trim ($ tokens [$ propertyNamePosition ]['content ' ], '$ ' );
146
+
147
+ if (strtolower ($ tokens [$ isShortDescriptionPreviousVar ]['content ' ]) === strtolower ($ propertyName )) {
148
+ $ error = 'Short description duplicates class property name. ' ;
149
+ $ phpcsFile ->addWarning ($ error , $ isShortDescriptionPreviousVar , 'AlreadyHaveMeaningfulNameVar ' );
150
+ return ;
151
+ }
152
+
146
153
$ propertyNameParts = array_filter (preg_split ('/(?=[A-Z])/ ' , $ propertyName ));
147
154
148
- if (stripos ($ tokens [$ isShortDescriptionPreviousVar ]['content ' ], implode ('' , $ propertyNameParts )) !== false ) {
155
+ if (strtolower ($ tokens [$ isShortDescriptionPreviousVar ]['content ' ]) === strtolower ( implode (' ' , $ propertyNameParts ))) {
149
156
$ error = 'Short description duplicates class property name. ' ;
150
157
$ phpcsFile ->addWarning ($ error , $ isShortDescriptionPreviousVar , 'AlreadyHaveMeaningfulNameVar ' );
151
158
}
Original file line number Diff line number Diff line change @@ -65,14 +65,7 @@ class Bar {
65
65
private $ variableName ;
66
66
67
67
/**
68
- * Some more invalid description with test which is the same name as the variable and is not allowed
69
- *
70
- * @var test
71
- */
72
- protected $ test ;
73
-
74
- /**
75
- * Formatted Correctly Protected Class Member
68
+ * Correctly Formatted Protected Class Member
76
69
*
77
70
* @var correctlyFormattedProtectedClassMember
78
71
*/
@@ -120,4 +113,11 @@ class correctlyFormattedClassMemberDocBlock
120
113
* @var RulePool
121
114
*/
122
115
protected $ rulePool ;
116
+
117
+ /**
118
+ * A description that includes test which is the same name as the variable is allowed
119
+ *
120
+ * @var test
121
+ */
122
+ protected $ test ;
123
123
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function getWarningList()
33
33
56 => 1 ,
34
34
63 => 1 ,
35
35
68 => 1 ,
36
- 82 => 1 ,
36
+ 75 => 1 ,
37
37
];
38
38
}
39
39
}
You can’t perform that action at this time.
0 commit comments