From:  gsherwood@squiz.net
Date:  09 Jan 2015 07:59:27 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

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

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=20481&edit=1

 ID:               20481
 Updated by:       gsherwood@squiz.net
 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: 
https://github.com/squizlabs/PHP_CodeSniffer/commit/96c83a2437c41c8d196090cd6fa
ee8ada65e7119


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
that:
PHP files must only contain PHP code (Generic.Files.InlineHTML.Found);
and
The opening PHP tag must be the first content in the file 
(Generic.PHP.CharacterBeforePHPOpeningTag.Found)

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

Description:
------------
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-
ci.com and assumed its a general problem)

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