- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.5k
 
Open
Labels
Description
Describe the bug
I ran phpcbf with --sniffs option.
$ vendor/bin/phpcbf --sniffs=Generic.PHP.DisallowShortOpenTag /path/to/filesI expected this command to only fix Generic.PHP.DisallowShortOpenTag, but some other errors are fixed too.
Code sample
<?
function test() {
if (true) {
  echo 1;
}
}Custom ruleset
<?xml version="1.0" ?>
<ruleset>
  <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  <rule ref="Generic.WhiteSpace.ScopeIndent"/>
</ruleset>To reproduce
Steps to reproduce the behavior:
- Create a file called 
test.phpwith the code sample above... - Run 
phpcs --report=diff --sniffs=Generic.PHP.DisallowShortOpenTag --cache=.phpcs-cache test.php - See the result
 
--- test.php
+++ PHP_CodeSniffer
@@ -1,7 +1,7 @@
-<?
+<?php
 function test() {
 if (true) {
-  echo 1;
+          echo 1;
 }
 }Expected behavior
Indentation of line 5 should not be fixed.
Removing --cache solves the problem.
Versions (please complete the following information):
- OS: Ubuntu 18.04 on Windows 10 WSL 2
 - PHP: 8.2
 - PHPCS: 3.7.2
 - Standard: Custom