Skip to content

Commit 2f5160b

Browse files
trippogithub-actions[bot]
authored andcommitted
Fix styling
1 parent 79fafb6 commit 2f5160b

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/LaravelEnumHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __call(string $method, array $parameters): string
3232
}
3333

3434
if (Str::of($translation)->startsWith(self::translateBaseUniquePath())) {
35-
if($method === 'description') {
35+
if ($method === 'description') {
3636
return self::humanize($this->name);
3737
}
3838
throw new TranslationMissing($this, $method);
@@ -62,7 +62,7 @@ protected static function humanize(string $string): string
6262
->whenTest('/^[A-Z][a-z]+(?:[A-Z][a-z]+)*$/m', function ($string) {
6363
return $string->snake(' ')->title();
6464
}, function ($string) {
65-
return $string->replace('_',' ')->title();
65+
return $string->replace('_', ' ')->title();
6666
});
6767
}
6868

tests/Feature/LaravelEnumHelperTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
]);
7979

8080
it(' throw an exception if try to call fallback with no descriprion property', function ($enum, $lang) {
81-
expect(fn() => $enum->property($lang))->toThrow(TranslationMissing::class);
81+
expect(fn () => $enum->property($lang))->toThrow(TranslationMissing::class);
8282
})->with([
8383
[Status::PENDING, 'en'],
8484
[StatusPascalCase::NoResponse, 'it'],
@@ -362,7 +362,7 @@
362362
[StatusString::DISCARDED, StatusString::ACCEPTED], 'it', [
363363
'D' => 'Rifiutato',
364364
'A' => 'Accettato',
365-
],],
365+
], ],
366366
]);
367367

368368
it('can return an associative array of magic translations [value/name => translations] with method name both singular and plural', function ($enumClass, $cases, $lang, $result) {
@@ -383,9 +383,9 @@
383383
]);
384384

385385
it('throw an TranslationMissing exception', function () {
386-
expect(fn() => StatusString::NO_RESPONSE->notExist())->toThrow(TranslationMissing::class);
387-
expect(fn() => StatusString::notExists(null, 'it'))->toThrow(TranslationMissing::class);
388-
expect(fn() => Status::notExists(null))->toThrow(TranslationMissing::class);
386+
expect(fn () => StatusString::NO_RESPONSE->notExist())->toThrow(TranslationMissing::class);
387+
expect(fn () => StatusString::notExists(null, 'it'))->toThrow(TranslationMissing::class);
388+
expect(fn () => Status::notExists(null))->toThrow(TranslationMissing::class);
389389
});
390390

391391
it('use a fallback case name if a description translation missing without exception', function () {
@@ -397,16 +397,15 @@
397397
'Await decision',
398398
'Recognized valid',
399399
'No longer useful',
400-
'No Response' // NoResponse humanized
400+
'No Response', // NoResponse humanized
401401
])->not->toThrow(TranslationMissing::class);
402402
});
403403

404-
405404
it('use all fallbacks case names for description method if all translations missing without exception', function () {
406405
expect(StatusWithoutTranslations::descriptions())->toBe([
407406
'Pending', // PENDING humanized
408407
'Accepted', // ACCEPTED humanized
409408
'Discarded', // DISCARDED humanized
410-
'No Response' // NO_RESPONSE humanized
409+
'No Response', // NO_RESPONSE humanized
411410
])->not->toThrow(TranslationMissing::class);
412-
});
411+
});

tests/lang/en/enums.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Datomatic\LaravelEnumHelper\Tests\Support\Enums\Status;
66
use Datomatic\LaravelEnumHelper\Tests\Support\Enums\StatusInt;
7-
use Datomatic\LaravelEnumHelper\Tests\Support\Enums\StatusPascalCase;
87
use Datomatic\LaravelEnumHelper\Tests\Support\Enums\StatusPascalCaseWithoutTranslation;
98
use Datomatic\LaravelEnumHelper\Tests\Support\Enums\StatusString;
109

0 commit comments

Comments
 (0)