File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
src/Standards/Generic/Sniffs/WhiteSpace Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
155
155
-- Thanks to Juliette Reinders Folmer for the patch
156
156
- Fixed bug #3192 : findStartOfStatement doesn't work correctly inside switch
157
157
-- Thanks to Vincent Langlet for the patch
158
+ - Fixed bug #3195 : Generic.WhiteSpace.ScopeIndent confusing message when combination of tabs and spaces found
158
159
- Fixed bug #3197 : Squiz.NamingConventions.ValidVariableName does not use correct error code for all member vars
159
160
- Fixed bug #3219 : Generic.Formatting.MultipleStatementAlignment false positive for empty anonymous classes and closures
160
161
- Fixed bug #3258 : Squiz.Formatting.OperatorBracket duplicate error messages for unary minus
Original file line number Diff line number Diff line change @@ -973,18 +973,38 @@ public function process(File $phpcsFile, $stackPtr)
973
973
}
974
974
975
975
if ($ this ->tabIndent === true ) {
976
- $ error .= '%s tabs, found %s ' ;
977
- $ data = [
978
- floor ($ checkIndent / $ this ->tabWidth ),
979
- floor ($ tokenIndent / $ this ->tabWidth ),
980
- ];
976
+ $ expectedTabs = floor ($ checkIndent / $ this ->tabWidth );
977
+ $ foundTabs = floor ($ tokenIndent / $ this ->tabWidth );
978
+ $ foundSpaces = ($ tokenIndent - ($ foundTabs * $ this ->tabWidth ));
979
+ if ($ foundSpaces > 0 ) {
980
+ if ($ foundTabs > 0 ) {
981
+ $ error .= '%s tabs, found %s tabs and %s spaces ' ;
982
+ $ data = [
983
+ $ expectedTabs ,
984
+ $ foundTabs ,
985
+ $ foundSpaces ,
986
+ ];
987
+ } else {
988
+ $ error .= '%s tabs, found %s spaces ' ;
989
+ $ data = [
990
+ $ expectedTabs ,
991
+ $ foundSpaces ,
992
+ ];
993
+ }
994
+ } else {
995
+ $ error .= '%s tabs, found %s ' ;
996
+ $ data = [
997
+ $ expectedTabs ,
998
+ $ foundTabs ,
999
+ ];
1000
+ }//end if
981
1001
} else {
982
1002
$ error .= '%s spaces, found %s ' ;
983
1003
$ data = [
984
1004
$ checkIndent ,
985
1005
$ tokenIndent ,
986
1006
];
987
- }
1007
+ }//end if
988
1008
989
1009
if ($ this ->debug === true ) {
990
1010
$ line = $ tokens [$ checkToken ]['line ' ];
You can’t perform that action at this time.
0 commit comments