Skip to content

Undefined index Tokenizers/JS.php #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
grappler opened this issue Jan 14, 2017 · 2 comments
Closed

Undefined index Tokenizers/JS.php #1272

grappler opened this issue Jan 14, 2017 · 2 comments

Comments

@grappler
Copy link

Related to #1271

When running PHPCS 2.7.1 on html5.js I get the following PHP notice.

Processing html5.js PHP Notice:  Undefined index: */ in  CodeSniffer/Tokenizers/JS.php on line 730

Notice: Undefined index: */ in  CodeSniffer/Tokenizers/JS.php on line 730
[JS => 1813 tokens in 278 lines]... DONE in 38ms (0 errors, 0 warnings)
@gsherwood
Copy link
Member

The file has a syntax error in it, where the first comment does not open the comment correctly, so PHPCS (and tools like JSLint) can't match the comments correctly:

//**
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/

I've made some changes over recent versions to hide errors caused by syntax errors in PHP code, so I think it makes sense to do the same here.

@gsherwood
Copy link
Member

I've added guard code for this specific syntax error. Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants