mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 04:10:51 +00:00
[BUGFIX] Respect indent_size for tabs (#81)
- Do not take tab_width into account. This is interpreted by the editor program
This commit is contained in:
parent
9fd252d8ae
commit
b5c00cbf1c
|
@ -48,7 +48,7 @@ final class JsonFileFormatterTest extends AbstractTestCase
|
|||
$file = new File($inputFileInfo, $inputFileInfo->getContents());
|
||||
|
||||
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTabWithSize(1));
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTab());
|
||||
|
||||
$this->jsonFileFormatter->format($file, $editorConfigConfigurationBuilder->build());
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ final class XmlFileFormatterTest extends AbstractTestCase
|
|||
$file = new File($inputFileInfo, $inputFileInfo->getContents());
|
||||
|
||||
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTabWithSize(1));
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTab());
|
||||
|
||||
$this->xmlFileFormatter->format($file, $editorConfigConfigurationBuilder->build());
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ final class EditorConfigConfigurationTest extends TestCase
|
|||
public function testIndentForTab(): void
|
||||
{
|
||||
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTabWithSize(4));
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTab());
|
||||
|
||||
$editorConfigConfiguration = $editorConfigConfigurationBuilder->build();
|
||||
|
||||
$this->assertSame(' ', $editorConfigConfiguration->getIndent());
|
||||
$this->assertSame(' ', $editorConfigConfiguration->getIndent());
|
||||
}
|
||||
|
||||
public function testIndentForSpace(): void
|
||||
|
|
|
@ -37,7 +37,7 @@ final class IndentTest extends TestCase
|
|||
public function testFromSizeAndStyleWithInvalidSizeThrowsException(): void
|
||||
{
|
||||
$this->expectException(InvalidIndentSizeException::class);
|
||||
Indent::createTabWithSize(0);
|
||||
Indent::fromSizeAndStyle(0, 'invalid');
|
||||
}
|
||||
|
||||
public function testFromSizeAndStyleWithInvalidStyleThrowsException(): void
|
||||
|
|
|
@ -51,12 +51,6 @@ final class EditorConfigParser
|
|||
$editorConfigConfigurationBuilder->withInsertFinalNewline($insertFinalNewline);
|
||||
}
|
||||
|
||||
if (array_key_exists(EditorConfigOption::TAB_WIDTH, $configuration)) {
|
||||
$editorConfigConfigurationBuilder->withIndentSize(
|
||||
$configuration[EditorConfigOption::TAB_WIDTH]->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
return $editorConfigConfigurationBuilder->build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ final class XmlFileFormatter implements FileFormatterInterface
|
|||
{
|
||||
$editorConfigConfigurationBuilder = new EditorConfigConfigurationBuilder();
|
||||
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTabWithSize(1));
|
||||
$editorConfigConfigurationBuilder->withIndent(Indent::createTab());
|
||||
|
||||
return $editorConfigConfigurationBuilder;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ final class Indent
|
|||
return self::fromSizeAndStyle($size, self::SPACE);
|
||||
}
|
||||
|
||||
public static function createTabWithSize(int $size): self
|
||||
public static function createTab(): self
|
||||
{
|
||||
return self::fromSizeAndStyle($size, self::TAB);
|
||||
return self::fromSizeAndStyle(1, self::TAB);
|
||||
}
|
||||
|
||||
public static function fromSizeAndStyle(int $size, string $style): self
|
||||
|
|
Loading…
Reference in New Issue
Block a user