File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Magento2/Sniffs/Annotation Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,23 @@ private function isTokenBeforeClosingCommentTagValid(string $type): bool
7070 private function validateCommentBlockExists (File $ phpcsFile , int $ previousCommentClosePtr , int $ stackPtr ): bool
7171 {
7272 $ tokens = $ phpcsFile ->getTokens ();
73+ $ attributeFlag = false ;
7374 for ($ tempPtr = $ previousCommentClosePtr + 1 ; $ tempPtr < $ stackPtr ; $ tempPtr ++) {
75+ $ tokenCode = $ tokens [$ tempPtr ]['code ' ];
76+
77+ // Ignore attributes e.g. #[\ReturnTypeWillChange]
78+ if ($ tokenCode === T_ATTRIBUTE_END ) {
79+ $ attributeFlag = false ;
80+ continue ;
81+ }
82+ if ($ attributeFlag ) {
83+ continue ;
84+ }
85+ if ($ tokenCode === T_ATTRIBUTE ) {
86+ $ attributeFlag = true ;
87+ continue ;
88+ }
89+
7490 if (!$ this ->isTokenBeforeClosingCommentTagValid ($ tokens [$ tempPtr ]['type ' ])) {
7591 return false ;
7692 }
You can’t perform that action at this time.
0 commit comments