File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/Standards/Generic/Sniffs/Files Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 14
14
15
15
class FileExtensionSniff implements Sniff
16
16
{
17
+
18
+
17
19
/**
18
20
* Returns an array of tokens this test wants to listen for.
19
21
*
@@ -37,14 +39,19 @@ public function register()
37
39
*/
38
40
public function process (File $ phpcsFile , $ stackPtr )
39
41
{
40
- $ perms = fileperms ($ phpcsFile ->getFilename ());
42
+ $ filename = $ phpcsFile ->getFilename ();
43
+
44
+ if ($ filename !== 'STDIN ' ) {
45
+ $ perms = fileperms ($ phpcsFile ->getFilename ());
46
+
47
+ if (($ perms & 0x0040 ) !== 0 || ($ perms & 0x0008 ) !== 0 || ($ perms & 0x0001 ) !== 0 ) {
48
+ $ error = "A PHP file must not be executable " ;
49
+ $ phpcsFile ->addError ($ error , $ stackPtr , 'Executable ' );
50
+ }
41
51
42
- if ($ perms & 0x0040 || $ perms & 0x0008 || $ perms & 0x0001 ) {
43
- $ error = "A PHP file must not be executable " ;
44
- $ phpcsFile ->addError ($ error , $ stackPtr , 'Executable ' );
52
+ // Ignore the rest of the file.
45
53
}
46
54
47
- // Ignore the rest of the file.
48
55
return ($ phpcsFile ->numTokens + 1 );
49
56
50
57
}//end process()
You can’t perform that action at this time.
0 commit comments