PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

`Squiz.NamingConventions.ValidVariableName` Does Not Provide Fixes via `phpcbf`

Open Justintime50 opened this issue 2 years ago • 0 comments

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:

  1. Create a file called test.php with the code sample above...
  2. Run phpcbf test.php ...
  3. 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

Justintime50 avatar Jul 14 '22 15:07 Justintime50