File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ public function process(File $phpcsFile, $stackPtr)
68
68
}
69
69
70
70
if (true === $ correctly_placed ) {
71
-
72
71
if (\T_COMMENT === $ tokens [ $ previous_comment ]['code ' ]) {
73
72
$ phpcsFile ->addError (
74
73
'A "hook" comment must be a "/**" style docblock comment. ' ,
@@ -83,6 +82,17 @@ public function process(File $phpcsFile, $stackPtr)
83
82
// Iterate through each comment to check for "@since" tag.
84
83
foreach ($ tokens [ $ comment_start ]['comment_tags ' ] as $ tag ) {
85
84
if ($ tokens [$ tag ]['content ' ] === '@since ' ) {
85
+ // Check if there is a version after the @since tag.
86
+ if (! preg_match ('/\d+\.\d+\.?\d?/ ' , $ tokens [$ tag +2 ]['content ' ])) {
87
+ $ phpcsFile ->addError (
88
+ 'A "@since" tag was found but no version declared. Required format <x.x> or <x.x.x> ' ,
89
+ $ stackPtr ,
90
+ 'MissingSinceVersionComment '
91
+ );
92
+
93
+ return ;
94
+ }
95
+
86
96
return ;
87
97
}
88
98
}
You can’t perform that action at this time.
0 commit comments