r/PHPhelp • u/kAlvaro • Nov 21 '22
Solved Extensionless scripts in PHP_CodeSniffer
Is there a way to configure phpcs.xml to analyse command-line scripts that do not have an extension?
#!/bin/env php
<?php
phpinfo();If I use <file> to set the path of the script directory (or even individual files), it seems that the extensions argument still kicks in and my files are ignored.
<arg name="extensions" value="php,phtml"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<file>.</file>
<file>scripts</file>
<file>scripts/phpinfo</file>
8
Upvotes
3
u/bkdotcom Nov 21 '22
extensions need not be specified
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset
also:
so if you're wanting to scan a file with a different extension, you probably need to specify that with "extensions"