File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 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)
143143 return ;
144144 };
145145 $ 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+
146153 $ propertyNameParts = array_filter (preg_split ('/(?=[A-Z])/ ' , $ propertyName ));
147154
148- if (stripos ($ tokens [$ isShortDescriptionPreviousVar ]['content ' ], implode ('' , $ propertyNameParts )) !== false ) {
155+ if (strtolower ($ tokens [$ isShortDescriptionPreviousVar ]['content ' ]) === strtolower ( implode (' ' , $ propertyNameParts ))) {
149156 $ error = 'Short description duplicates class property name. ' ;
150157 $ phpcsFile ->addWarning ($ error , $ isShortDescriptionPreviousVar , 'AlreadyHaveMeaningfulNameVar ' );
151158 }
Original file line number Diff line number Diff line change @@ -65,14 +65,7 @@ class Bar {
6565 private $ variableName ;
6666
6767 /**
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
7669 *
7770 * @var correctlyFormattedProtectedClassMember
7871 */
@@ -120,4 +113,11 @@ class correctlyFormattedClassMemberDocBlock
120113 * @var RulePool
121114 */
122115 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 ;
123123}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public function getWarningList()
3333 56 => 1 ,
3434 63 => 1 ,
3535 68 => 1 ,
36- 82 => 1 ,
36+ 75 => 1 ,
3737 ];
3838 }
3939}
You can’t perform that action at this time.
0 commit comments