Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Jun 30, 2024
1 parent d6b956e commit be35799
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function __construct(?RuleSetInterface $ruleSet)
$this->setRiskyAllowed(true);
}

/**
* Sets the rules for the configuration.
*/
public function setRules(array $rules = []): ConfigInterface
{
$ruleSet = $this->ruleSet ? $this->ruleSet->rules() : [];
Expand All @@ -31,7 +34,7 @@ public function setRules(array $rules = []): ConfigInterface
}

/**
* Create a new config instance
* Create a new config
*
* @return self
*/
Expand Down
9 changes: 0 additions & 9 deletions tests/Unit/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,19 @@

class FinderTest extends TestCase
{
/**
* It returns a PHP CS Fixer finder object
*/
public function testFinderMustReturnsAPhpCsFinderObject(): void
{
$this->assertInstanceOf(PhpCsFixerFinder::class, new Finder);
$this->assertInstanceOf(PhpCsFixerFinder::class, Finder::create());
}

/**
* It returns a PHP CS Fixer finder object
*/
public function testBaseFinderMustReturnsAPhpCsFinderObject(): void
{
$finder = Finder::base(__DIR__);

$this->assertInstanceOf(PhpCsFixerFinder::class, $finder);
}

/**
* It returns a PHP CS Fixer finder object
*/
public function testLaravelFinderMustReturnsAPhpCsFinderObject(): void
{
$finder = Finder::laravel(__DIR__.'/../..');
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/RuleSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class RuleSetTest extends TestCase
{
/**
* Nama yang dikembalikan haruslah nama kelas itu sendiri dengan awalan `@`.
* The name must be the name of the class itself with an `@` prefix.
*/
public function testRuleSetName(): void
{
Expand All @@ -20,8 +20,7 @@ public function testRuleSetName(): void
}

/**
* Nama yang dikembalikan haruslah nama yang telah ditetapkan di dalam kelas
* tersebut.
* The name must be the name defined in the class.
*/
public function testRuleSetNameWithSetName(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/ValidRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ValidRulesTest extends TestCase
*/
public function testRealodixReturnsAValidPhpCsFIxerRules(): void
{
$rules = $this->getCleanedRules(new \Realodix\Relax\RuleSet\Sets\Realodix);
$rules = $this->resolveRules(new \Realodix\Relax\RuleSet\Sets\Realodix);
$factory = (new FixerFactory)
->registerBuiltInFixers()
->useRuleSet(new PhpCsFixerRuleSet($rules));
Expand All @@ -27,7 +27,7 @@ public function testRealodixReturnsAValidPhpCsFIxerRules(): void
*/
public function testRealodixPlusReturnsAValidPhpCsFIxerRules(): void
{
$rules = $this->getCleanedRules(new \Realodix\Relax\RuleSet\Sets\RealodixPlus);
$rules = $this->resolveRules(new \Realodix\Relax\RuleSet\Sets\RealodixPlus);
$factory = (new FixerFactory)
->registerBuiltInFixers()
->useRuleSet(new PhpCsFixerRuleSet($rules));
Expand All @@ -38,7 +38,7 @@ public function testRealodixPlusReturnsAValidPhpCsFIxerRules(): void
/**
* Remove PHP-CS-Fixer rule sets (@...) and custom fixer.
*/
protected function getCleanedRules($ruleSet): array
protected function resolveRules($ruleSet): array
{
$rules = Config::create($ruleSet)->getRules();

Expand Down

0 comments on commit be35799

Please sign in to comment.