@@ -44,25 +44,28 @@ public function process(File $phpcsFile, $stackPtr)
44
44
return $ phpcsFile ->numTokens ;
45
45
}
46
46
47
- $ next = $ phpcsFile ->findNext (T_INLINE_HTML , 0 );
48
- if ($ next !== false ) {
49
- // This rule only applies to PHP-only files.
50
- return $ phpcsFile ->numTokens ;
51
- }
52
-
53
47
$ tokens = $ phpcsFile ->getTokens ();
54
48
$ next = $ phpcsFile ->findNext (T_WHITESPACE , ($ stackPtr + 1 ), null , true );
55
49
if ($ next === false ) {
56
50
// Empty file.
57
51
return $ phpcsFile ->numTokens ;
58
52
}
59
53
60
- if ($ tokens [$ next ]['line ' ] === $ tokens [$ stackPtr ]['line ' ]) {
61
- $ error = 'Opening PHP tag must be on a line by itself ' ;
62
- $ fix = $ phpcsFile ->addFixableError ($ error , $ stackPtr , 'NotAlone ' );
63
- if ($ fix === true ) {
64
- $ phpcsFile ->fixer ->addNewline ($ stackPtr );
65
- }
54
+ if ($ tokens [$ next ]['line ' ] !== $ tokens [$ stackPtr ]['line ' ]) {
55
+ // Tag is on a line by itself.
56
+ return $ phpcsFile ->numTokens ;
57
+ }
58
+
59
+ $ next = $ phpcsFile ->findNext (T_INLINE_HTML , 0 );
60
+ if ($ next !== false ) {
61
+ // This rule only applies to PHP-only files.
62
+ return $ phpcsFile ->numTokens ;
63
+ }
64
+
65
+ $ error = 'Opening PHP tag must be on a line by itself ' ;
66
+ $ fix = $ phpcsFile ->addFixableError ($ error , $ stackPtr , 'NotAlone ' );
67
+ if ($ fix === true ) {
68
+ $ phpcsFile ->fixer ->addNewline ($ stackPtr );
66
69
}
67
70
68
71
return $ phpcsFile ->numTokens ;
0 commit comments