Skip to content

Files

Latest commit

 

History

History
25 lines (17 loc) · 1.06 KB

Universal.WhiteSpace.DisallowInlineTabs.md

File metadata and controls

25 lines (17 loc) · 1.06 KB

Pattern: Use of inline tabs

Issue: -

Description

Enforces using spaces for mid-line alignment.

While tab versus space based indentation is a question of preference, for mid-line alignment, spaces should always be preferred, as using tabs will result in inconsistent formatting depending on the dev-user's chosen tab width.

This sniff is especially useful for tab-indentation based standards which use the Generic.Whitespace.DisallowSpaceIndent sniff to enforce this.

DO make sure to set the PHPCS native tab-width configuration for the best results.

   <arg name="tab-width" value="4"/>

The PHPCS native Generic.Whitespace.DisallowTabIndent sniff (used for space-based standards) oversteps its reach and silently does mid-line tab to space replacements as well. However, the sister-sniff Generic.Whitespace.DisallowSpaceIndent leaves mid-line tabs/spaces alone. This sniff fills that gap.

Further Reading