Skip to content

Commit 041579f

Browse files
committed
allow shebang in PSR1 Files/SideEffectsSniff
1 parent 0abb1df commit 041579f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CodeSniffer/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ private function _searchForConflict(PHP_CodeSniffer_File $phpcsFile, $start, $en
119119
continue;
120120
}
121121

122+
// Ignore shebang.
123+
if (substr($tokens[$i]['content'], 0, 2) === '#!') {
124+
continue;
125+
}
126+
122127
// Ignore entire namespace, declare, const and use statements.
123128
if ($tokens[$i]['code'] === T_NAMESPACE
124129
|| $tokens[$i]['code'] === T_USE
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
//some code
5+
function foo()
6+
{
7+
return 'bar';
8+
}

0 commit comments

Comments
 (0)