@@ -30,22 +30,32 @@ public function register()
30
30
*/
31
31
public function process (File $ phpcsFile , $ stackPtr )
32
32
{
33
- $ positionOpenTag = $ phpcsFile ->findPrevious (T_OPEN_TAG , $ stackPtr - 1 );
34
-
35
- if ($ positionOpenTag === false ) {
36
- $ positionComment = $ phpcsFile ->findNext (T_DOC_COMMENT_STRING , $ stackPtr );
37
- $ contentFile = $ phpcsFile ->getTokens ()[$ positionComment ]['content ' ];
38
- $ adobeCopyrightFound = preg_match (self ::COPYRIGHT_ADOBE , $ contentFile );
39
-
40
- if (strpos ($ contentFile , self ::COPYRIGHT_MAGENTO_TEXT ) !== false || $ adobeCopyrightFound ) {
41
- return ;
42
- } else {
43
- $ phpcsFile ->addWarningOnLine (
44
- 'Copyright is missing or has wrong format ' ,
45
- $ phpcsFile ->getTokens ()[$ positionComment ]['line ' ],
46
- self ::WARNING_CODE
47
- );
48
- }
33
+ if ($ phpcsFile ->findPrevious (T_OPEN_TAG , $ stackPtr - 1 ) !== false ) {
34
+ return ;
49
35
}
36
+
37
+ $ positionComment = $ phpcsFile ->findNext (T_DOC_COMMENT_STRING , $ stackPtr );
38
+
39
+ if ($ positionComment === false ) {
40
+ $ phpcsFile ->addWarning (
41
+ 'Copyright is missing ' ,
42
+ $ stackPtr ,
43
+ self ::WARNING_CODE
44
+ );
45
+ return ;
46
+ }
47
+
48
+ $ content = $ phpcsFile ->getTokens ()[$ positionComment ]['content ' ];
49
+ $ adobeCopyrightFound = preg_match (self ::COPYRIGHT_ADOBE , $ content );
50
+
51
+ if (strpos ($ content , self ::COPYRIGHT_MAGENTO_TEXT ) !== false || $ adobeCopyrightFound ) {
52
+ return ;
53
+ }
54
+
55
+ $ phpcsFile ->addWarningOnLine (
56
+ 'Copyright is missing or has wrong format ' ,
57
+ $ phpcsFile ->getTokens ()[$ positionComment ]['line ' ],
58
+ self ::WARNING_CODE
59
+ );
50
60
}
51
61
}
0 commit comments