File tree Expand file tree Collapse file tree 4 files changed +67
-2
lines changed Expand file tree Collapse file tree 4 files changed +67
-2
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
6767 }
6868
6969 $ commentStart = $ tokens [$ commentEnd ]['comment_opener ' ];
70+ if ($ this ->PHPDocFormattingValidator ->hasDeprecatedWellFormatted ($ commentStart , $ tokens ) !== true ) {
71+ $ phpcsFile ->addWarning (
72+ 'Motivation behind the added @deprecated tag MUST be explained. '
73+ . '@see tag MUST be used with reference to new implementation when code is deprecated '
74+ . 'and there is a new alternative. ' ,
75+ $ stackPtr ,
76+ 'InvalidDeprecatedTagUsage '
77+ );
78+ }
7079 $ varAnnotationPosition = null ;
7180 foreach ($ tokens [$ commentStart ]['comment_tags ' ] as $ tag ) {
7281 if ($ tokens [$ tag ]['content ' ] === '@var ' ) {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function getWarningList($testFile = '')
3535 101 => 1 ,
3636 109 => 1 ,
3737 118 => 1 ,
38- 127 => 1 ,
38+ 127 => 1
3939 ];
4040 }
4141}
Original file line number Diff line number Diff line change @@ -142,4 +142,56 @@ class correctlyFormattedClassMemberDocBlock
142142 * @var string|null
143143 */
144144 protected ?string $ test2 ;
145+
146+ /**
147+ * @var string
148+ * @deprecated
149+ */
150+ protected string $ badlyDeprecated ;
151+
152+ /**
153+ * @var string
154+ * @deprecated Why not
155+ */
156+ protected string $ incorrectlyDeprecated ;
157+
158+ /**
159+ * @var string
160+ * @deprecated
161+ * @see
162+ */
163+ protected string $ inaccurately ;
164+
165+ /**
166+ * @var string
167+ * @deprecated No reference specified
168+ * @see
169+ */
170+ protected string $ mistakenly ;
171+
172+ /**
173+ * @var string
174+ * @deprecated No reference specified
175+ * @see Some reference
176+ */
177+ protected string $ correctly ;
178+
179+ /**
180+ * @var string
181+ * @deprecated
182+ * @see Some other reference
183+ */
184+ protected string $ alsoCorrect ;
185+
186+ /**
187+ * @var string
188+ * @see
189+ */
190+ protected string $ shouldBeCorrect ;
191+
192+ /**
193+ * @var string
194+ * @see Message with some reference
195+ */
196+ protected string $ itIsCorrect ;
145197}
Original file line number Diff line number Diff line change @@ -34,7 +34,11 @@ public function getWarningList()
3434 63 => 1 ,
3535 68 => 1 ,
3636 75 => 1 ,
37- 125 => 1
37+ 125 => 1 ,
38+ 150 => 1 ,
39+ 156 => 1 ,
40+ 163 => 1 ,
41+ 170 => 1
3842 ];
3943 }
4044}
You can’t perform that action at this time.
0 commit comments