[CS] Fix dynamic and broken indent detection, allow to configure spacing via RectorConfig::indent() method #2442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes rectorphp/rector#7210
At the moment, the indent detection depens on every single space token in the code. If there is one tab, the code will be changed to tabs, which is non-sense.
When we look at the php-parser issue related to indentation, there is a possible way to configure the printer via options:
nikic/PHP-Parser#723 (comment)
Saying that, instead of magical indent guessing per file, we should let user configure the default space indent:
Files must respect one indent way.
The rest code should be handled by CS tool like before: https://github.com/rectorphp/rector#how-to-apply-coding-standards