@@ -44,25 +44,28 @@ public function process(File $phpcsFile, $stackPtr)
4444 return $ phpcsFile ->numTokens ;
4545 }
4646
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-
5347 $ tokens = $ phpcsFile ->getTokens ();
5448 $ next = $ phpcsFile ->findNext (T_WHITESPACE , ($ stackPtr + 1 ), null , true );
5549 if ($ next === false ) {
5650 // Empty file.
5751 return $ phpcsFile ->numTokens ;
5852 }
5953
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 );
6669 }
6770
6871 return $ phpcsFile ->numTokens ;
0 commit comments