Skip to content

Commit

Permalink
CharacterBeforePHPOpeningTagSniff: Support T_HASHBANG for HHVM >=3.5,…
Browse files Browse the repository at this point in the history
…<3.7

token_get_all() in HHVM >=3.5,<3.7 will interpret a hashbang as T_HASHBANG
rather than T_INLINE_HTML like PHP5.

This has been fixed upstream in <facebook/hhvm#5023>,
but we need to support 3.6.0.

Bug: T103119
Change-Id: Iac4745580bae313505af370d6361c800f5587f5a
  • Loading branch information
legoktm committed Jun 19, 2015
1 parent 178e271 commit 7cf13be
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) {
// so the first token is on the first line

// check if it is valid shebang
if ( $tokens[0]['type'] == 'T_INLINE_HTML'
// T_HASHBANG is a token used in HHVM >=3.5, <3.7 (T103119)
if ( in_array( $tokens[0]['type'], array( 'T_INLINE_HTML', 'T_HASHBANG' ) )
&& substr( $tokens[0]['content'], 0, 2 ) == '#!' ) {
$validShebang = true;
}
Expand Down

0 comments on commit 7cf13be

Please sign in to comment.