You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DisallowSpaceIndent: Fix the case of the moving space
Given this code:
```php
wp_die( $api ); // Tab - Space - Tab - Tab
```
with tab width set to `4`, `wp_die()` would start in column 13.
The sniff was currently fixing this to:
```php
wp_die( $api ); // Tab - Tab - Tab - Space
```
which changed the start column to 14 and changed the "space hidden before a tab" to precision alignment.
This commit fixes that and is a further iteration building onto the improvements in 1404.
The above code will now be fixed as:
```php
wp_die( $api ); // Tab - Tab - Tab
```
Notes:
* As the tabs in whitespace at the start of `T_INLINE_HTML` and `T_COMMENT` tokens is not replaced by spaces in the `content` by the tokenizer, this has to be done within the sniff to determine what the correct length of the whitespace should be.
* Basing the correction of the space-based length of the whitespace allows for fixing with higher precision.
* Incidentally, this also fixes one of the metrics being recorded incorrectly. For in-depth details of the effect on the metrics of this fix, please see: https://gist.github.com/jrfnl/5e2d75894c8e60a8f314b9fcb0ad3f62
* The `tabWidth` is now set in the unit test file.
0 commit comments