PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
`Squiz.NamingConventions.ValidVariableName` Does Not Provide Fixes via `phpcbf`
Describe the bug
I can run phpcbf
for all my current rules and have them automatically fixed; however, there is no fixer for Squiz.NamingConventions.ValidVariableName
rules to take my $snake_case
variables and turn them into $camelCase
. I would expect the tool to be able to do so as converting hundreds of those errors manually would be taxing and error-prone. The particular sniff I'm using is Squiz.NamingConventions.ValidVariableName.NotCamelCaps
which should be pretty simple to determine which variables need correcting.
Code sample
echo $snake_case_variable;
Custom ruleset
<?xml version="1.0"?>
<ruleset name="My Custom Standard">
<description>If you are using a custom ruleset, please enter it here.</description>
</ruleset>
To reproduce Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above... - Run
phpcbf test.php ...
- See error message displayed
No fixable errors were found
Expected behavior PHP_CodeSniffer would automatically correct my snake case variables to be camel case.
Versions (please complete the following information):
- OS: MacOS 10.15
- PHP: 7.4
- PHPCS: 3.6
- Standard: PSR12