Date:  09 Jan 2015 07:59:27 Hong Kong Time

[PEAR-BUG] Req #20481 [Asn->Csd]: detect/ignore shebang as first line

NNTP-Posting-Host:  null

Edit report at

 ID:               20481
 Updated by:
 Reported By:      flyingmana at googlemail dot com
 Summary:          detect/ignore shebang as first line
-Status:           Assigned
+Status:           Closed
 Type:             Feature/Change Request
 Package:          PHP_CodeSniffer
 Package Version:  Unknown
 PHP Version:      5.5.20
 Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status: Assigned
+Status: Closed
I've made the change for both sniffs here:

Previous Comments:

[2015-01-08 23:30:59] squiz

-Assigned To:
+Assigned To: squiz
The sniffs that would report this error are not included in any of the
standards that 
come with PHP_CodeSniffer; they are only in the Generic sniff
collection. Are you 
using a custom standard with scrutinizer-ci or is it a generic check
they are doing?

Never the less, there are 2 sniffs that report errors with code like
PHP files must only contain PHP code (Generic.Files.InlineHTML.Found);
The opening PHP tag must be the first content in the file 

I'll look into getting those sniffs to allow shebang lines in case you
are using one of 
those. If it is another, please let me know the error message and the
sniff code (use 
the -s command line argument to see the code).


[2015-01-08 01:14:57] flyingmana

the detection for a php opening tag as first content is not complete 
, as a shebang is valid content here in general

(I dont know actual versions, as I got this error on scrutinizer- and assumed its a general problem)

Test script:
#!/usr/bin/env php