New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow arbitrary space indentation #7818
base: master
Are you sure you want to change the base?
feat: allow arbitrary space indentation #7818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's solve the discussion before concluding on PR
@@ -25,8 +25,8 @@ final class WhitespacesFixerConfig | |||
|
|||
public function __construct(string $indent = ' ', string $lineEnding = "\n") | |||
{ | |||
if (!\in_array($indent, [' ', ' ', "\t"], true)) { | |||
throw new \InvalidArgumentException('Invalid "indent" param, expected tab or two or four spaces.'); | |||
if (!Preg::match('/^(?: +|\t)$/', $indent)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IF we would go forward direction to approve the PR, we need a new tests to prove it works:
- each fixer that uses WhitespacesFixerConfig should receive a new test with new whitespace variant(s)
- dedicated integration tests for new whitespace variant(s) (at least mimic
tests/Fixtures/Integration/set/@PSR12_whitespaces.test*.php
)
(i suggest to not invest into it till aligned into direction)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll convert this to a draft while I familiarize myself more with the codebase.
I created this PR to address the issue in #7810.
Removes the limitation of having only 2 or 4 space indentation and allows for any number of spaces or one tab in the indentation settings.
This could be modified to also allow for any number of tabs but I don't see a reason for it since tabs are already arbitrary sized.