Skip to content

Commit 35ebcd7

Browse files
fix: styling
1 parent c8acf8d commit 35ebcd7

File tree

13 files changed

+37
-34
lines changed

13 files changed

+37
-34
lines changed

packages/laravel-translations/src/Base/TranslationLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function getTranslationsFromDatabase(string $locale, string $group, ?s
3232
$translations->where('group', $group);
3333
}
3434

35-
return $translations->where(fn ($query) => $query->where('code', 'LIKE', $locale.'_%')->orWhere('code', $locale))
35+
return $translations->where(fn ($query) => $query->where('code', 'LIKE', $locale . '_%')->orWhere('code', $locale))
3636
->pluck('text', 'key')
3737
->toArray();
3838
}

packages/laravel-translations/src/Commands/SyncTranslations.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function syncItems(Collection $items): void
6666

6767
try {
6868
$itemsCount = $items
69-
->filter(function (TranslatesAttributes|Model $item) {
69+
->filter(function (TranslatesAttributes | Model $item) {
7070
$translations = $item->translatableAttributes()->count();
7171

7272
if ($translations === count($item->getTranslatableAttributes())) {
@@ -75,12 +75,12 @@ protected function syncItems(Collection $items): void
7575

7676
return true;
7777
})
78-
->map(fn (TranslatesAttributes|Model $item) => count($item->getTranslatableAttributes()))
78+
->map(fn (TranslatesAttributes | Model $item) => count($item->getTranslatableAttributes()))
7979
->sum();
8080

8181
$this->output->progressStart($itemsCount);
8282

83-
$items->each(function (TranslatesAttributes|Model $item) {
83+
$items->each(function (TranslatesAttributes | Model $item) {
8484
try {
8585
$item->syncTranslations($this->output);
8686
} catch (\Throwable $e) {
@@ -90,7 +90,7 @@ protected function syncItems(Collection $items): void
9090
} catch (\Throwable $e) {
9191
info('Payload is too large, syncing items one by one.');
9292

93-
progress('Syncing translatable items', $items, function (TranslatesAttributes|Model $item) {
93+
progress('Syncing translatable items', $items, function (TranslatesAttributes | Model $item) {
9494
try {
9595
$item->syncTranslations($this->output);
9696
} catch (\Throwable $e) {

packages/laravel-translations/src/Contracts/TranslatesAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ public function updateAttributesIfTranslatable(array $translatableAttributes): v
143143
* @param string $attribute Attribute name.
144144
* @return array|string Rules array or '*' string for all.
145145
*/
146-
public function getTranslatableAttributeRulesFor(string $attribute): array|string;
146+
public function getTranslatableAttributeRulesFor(string $attribute): array | string;
147147
}

packages/laravel-translations/src/Contracts/TranslatorContract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
interface TranslatorContract
66
{
7-
public function translate(string $text, string $targetLanguage): string|array;
7+
public function translate(string $text, string $targetLanguage): string | array;
88
}

packages/laravel-translations/src/Domain/Detection/Actions/DetectLanguageFromText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function handle($text): string
1818
$detected = $tr->getLastDetectedSource();
1919

2020
if (! $detected) {
21-
throw new \Exception('Language detection failed for text: '.$text);
21+
throw new \Exception('Language detection failed for text: ' . $text);
2222
}
2323

2424
return $detected;

packages/laravel-translations/src/Domain/Scanner/Actions/FindTranslatables.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ public static function scan(bool $mergeKeys = false): Collection
3535
* @var string $pattern
3636
*/
3737
$pattern =
38-
'[^\w]'.
39-
'(?<!->)'. // Ignore method chaining
40-
'(?:'.implode('|', $functions->toArray()).')'.
41-
'\(\s*'.
42-
'(?:'.
43-
"'((?:[^'\\\\]|\\\\.)+)'". // Match single-quoted keys
44-
'|'.
45-
'`((?:[^`\\\\]|\\\\.)+)`'. // Match backtick-quoted keys
46-
'|'.
47-
'"((?:[^"\\\\]|\\\\.)+)"'. // Match double-quoted keys
48-
'|'.
49-
'(\$[a-zA-Z_][a-zA-Z0-9_]*)'. // Match variables
50-
')'.
51-
'\s*'.
52-
'(?:,([^)]*))?'. // Capture second argument (parameters)
53-
'\s*'.
38+
'[^\w]' .
39+
'(?<!->)' . // Ignore method chaining
40+
'(?:' . implode('|', $functions->toArray()) . ')' .
41+
'\(\s*' .
42+
'(?:' .
43+
"'((?:[^'\\\\]|\\\\.)+)'" . // Match single-quoted keys
44+
'|' .
45+
'`((?:[^`\\\\]|\\\\.)+)`' . // Match backtick-quoted keys
46+
'|' .
47+
'"((?:[^"\\\\]|\\\\.)+)"' . // Match double-quoted keys
48+
'|' .
49+
'(\$[a-zA-Z_][a-zA-Z0-9_]*)' . // Match variables
50+
')' .
51+
'\s*' .
52+
'(?:,([^)]*))?' . // Capture second argument (parameters)
53+
'\s*' .
5454
'[\),]';
5555

5656
foreach ($finder as $file) {

packages/laravel-translations/src/Drivers/AITranslator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class AITranslator implements TranslatorContract
99
{
10-
public function translate(string|array $text, string $targetLanguage, ?string $extraPrompt = null): string|array
10+
public function translate(string | array $text, string $targetLanguage, ?string $extraPrompt = null): string | array
1111
{
1212
if (is_array($text)) {
1313
return $this->translateJson($text, $targetLanguage, $extraPrompt);
@@ -132,7 +132,7 @@ protected function translateJson(array $toBeJson, string $targetLanguage, ?strin
132132
PROMPT;
133133

134134
if ($extraPrompt) {
135-
$prompt = $extraPrompt."\n\n".$prompt;
135+
$prompt = $extraPrompt . "\n\n" . $prompt;
136136
}
137137

138138
$response = Prism::text()

packages/laravel-translations/src/Drivers/GoogleTranslator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class GoogleTranslator implements TranslatorContract
99
{
10-
public function translate(string $text, string $targetLanguage): string|array
10+
public function translate(string $text, string $targetLanguage): string | array
1111
{
1212
$tr = new GoogleTranslate;
1313

packages/laravel-translations/src/Jobs/ScanTranslationStrings.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
class ScanTranslationStrings implements ShouldQueue
1919
{
20-
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
20+
use Dispatchable;
21+
use InteractsWithQueue;
22+
use Queueable;
23+
use SerializesModels;
2124

2225
protected ?Language $locale;
2326

packages/laravel-translations/src/Models/Concerns/HasTranslatableAttributes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ public function updateAttributesIfTranslatable(array $translatableAttributes): v
180180
);
181181
}
182182

183-
public function getTranslatableAttributeRulesFor(string $attribute): array|string
183+
public function getTranslatableAttributeRulesFor(string $attribute): array | string
184184
{
185-
$methodName = 'getTranslatableAttributeRulesFor'.str($attribute)->studly();
185+
$methodName = 'getTranslatableAttributeRulesFor' . str($attribute)->studly();
186186

187187
if (! method_exists($this, $methodName)) {
188188
return '*';

0 commit comments

Comments
 (0)