Skip to content

Commit

Permalink
(chore): add set indent
Browse files Browse the repository at this point in the history
  • Loading branch information
FreakyWizard committed Nov 20, 2024
1 parent 16e7cb6 commit 960bb04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
return [
'line_ending' => "\n",
'risky_allowed' => true,
'set_indent' => "\t",
'rules' => [
'@PSR2' => true,
'indentation_type' => true,
Expand Down
3 changes: 2 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function setDefaultRules(): self

$this->setRules($this->configRule('rules', []))
->setLineEnding($this->configRule('line_ending', "\n"))
->setRiskyAllowed($this->configRule('risky_allowed', true));
->setRiskyAllowed($this->configRule('risky_allowed', true))
->setIndent($this->configRule('set_indent', "\t"));

return $this;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/Feature/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
expect($this->config->getRiskyAllowed())->not->toBeEmpty();
});

it('sets indent on create', function () {
expect($this->config->getIndent())->not->toBeEmpty();
});

it('can reset to default rules using setDefaultRules()', function () {
$defaultRules = $this->config->getRules();
$defaultLineEnding = $this->config->getLineEnding();
Expand Down Expand Up @@ -59,3 +63,9 @@

expect($this->config->getRiskyAllowed())->toBe(false);
});

it('can override indent', function () {
$this->config->setIndent(" ");

expect($this->config->getIndent())->toBe(" ");
});

0 comments on commit 960bb04

Please sign in to comment.