Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
danilopolani committed Aug 9, 2024
1 parent 315eb7d commit c4a6734
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion database/migrations/6_transform_logs_cc_bcc_array.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public function up(): void
{
$tableName = (new Log())->getTable();
$tableName = (new Log)->getTable();

DB::table($tableName)
->whereNotNull('cc')
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/Templates/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(private readonly Render $render)
*/
public function run(array $data): string
{
$template = Template::find($data['templateId']) ?: new Template();
$template = Template::find($data['templateId']) ?: new Template;
$template->content = $data['content'];

return rescue(
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/TokenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function handle(): int
);

info('Generated token:');
note((new GenerateToken())->run($name));
note((new GenerateToken)->run($name));

return self::SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/SendingFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function context(): array
return [
'logId' => $this->log?->id,
'trigger' => $this->log?->trigger,
'variables' => $this->log?->variables ?: new ArrayObject(),
'variables' => $this->log?->variables ?: new ArrayObject,
];
}
}
2 changes: 1 addition & 1 deletion src/Helpers/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function extractVariableNames(): array
{
$source = $this->template->layout?->content . $this->template->content;

$twig = new Environment(new ArrayLoader());
$twig = new Environment(new ArrayLoader);

try {
$nodes = $twig->parse(
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/SocialAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SocialAuthController extends Controller
public function redirect(): RedirectResponse
{
if (!MailCarrier::getSocialAuthDriver()) {
throw new SocialAuthNotEnabledException();
throw new SocialAuthNotEnabledException;
}

return Socialite::driver(MailCarrier::getSocialAuthDriver())->redirect();
Expand All @@ -29,7 +29,7 @@ public function redirect(): RedirectResponse
public function callback(SocialLogin $login): RedirectResponse
{
if (!MailCarrier::getSocialAuthDriver()) {
throw new SocialAuthNotEnabledException();
throw new SocialAuthNotEnabledException;
}

/** @var \Laravel\Socialite\AbstractUser $user */
Expand Down
10 changes: 5 additions & 5 deletions src/Http/Requests/SendMailRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public function rules(): array
'template' => 'required|exists:\MailCarrier\Models\Template,slug',
'trigger' => 'sometimes|string|max:255',
'subject' => 'required|string|max:255',
'sender' => ['sometimes', new ContactRule()],
'sender' => ['sometimes', new ContactRule],
'cc' => 'sometimes|array',
'bcc' => 'sometimes|array',
'cc.*' => [new ContactRule()],
'bcc.*' => [new ContactRule()],
'cc.*' => [new ContactRule],
'bcc.*' => [new ContactRule],
'variables' => 'sometimes|array',
'tags' => 'sometimes|array',
'metadata' => 'sometimes|array',
Expand Down Expand Up @@ -68,9 +68,9 @@ public function rules(): array
],
'recipients.*.variables' => 'sometimes|array',
'recipients.*.cc' => 'sometimes|array',
'recipients.*.cc.*' => [new ContactRule()],
'recipients.*.cc.*' => [new ContactRule],
'recipients.*.bcc' => 'sometimes|array',
'recipients.*.bcc.*' => [new ContactRule()],
'recipients.*.bcc.*' => [new ContactRule],

// Recipients attachments
'recipients.*.attachments' => 'sometimes|array',
Expand Down
2 changes: 1 addition & 1 deletion src/MailCarrierManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function upload(string $content, string $fileName): string
);

if (!$uploadResponse) {
throw new UploadException();
throw new UploadException;
}

return $filePath;
Expand Down
2 changes: 1 addition & 1 deletion src/MailCarrierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function packageRegistered(): void
$this->app->register(\Laravel\Socialite\SocialiteServiceProvider::class);
}

$this->app->scoped('mailcarrier', fn (): MailCarrierManager => new MailCarrierManager());
$this->app->scoped('mailcarrier', fn (): MailCarrierManager => new MailCarrierManager);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Models/Casts/CastUsingJsonFlags.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class CastUsingJsonFlags
public function __construct(
public int $encode = 0,
public int $decode = 0,
) {
}
) {}
}
2 changes: 1 addition & 1 deletion src/Models/Casts/DataTransferObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ protected function getJsonFlags(): CastUsingJsonFlags
->getAttributes(CastUsingJsonFlags::class);

return ($attributes[0] ?? null)?->newInstance()
?? new CastUsingJsonFlags();
?? new CastUsingJsonFlags;
}
}
2 changes: 1 addition & 1 deletion src/Resources/LogResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected static function getTableFilters(): array
->preload(),

Tables\Filters\SelectFilter::make('trigger')
->options((new GetTriggers())->run()),
->options((new GetTriggers)->run()),
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/TemplateResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function table(Tables\Table $table): Tables\Table
$newRecord->fill([
'user_id' => Auth::id(),
'name' => $name,
'slug' => (new GenerateSlug())->run($name),
'slug' => (new GenerateSlug)->run($name),
])->save();

redirect(TemplateResource::getUrl('edit', ['record' => $newRecord]));
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/TemplateResource/Pages/CreateTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function mutateFormDataBeforeCreate(array $data): array
return [
...$data,
'user_id' => Auth::id(),
'slug' => (new GenerateSlug())->run($this->data['name']),
'slug' => (new GenerateSlug)->run($this->data['name']),
];
}
}
2 changes: 1 addition & 1 deletion src/Resources/UserResource/Actions/CreateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function setUp(): void
Forms\Components\TextInput::make('email')
->email()
->required()
->unique((new User())->getTable(), 'email'),
->unique((new User)->getTable(), 'email'),

Forms\Components\TextInput::make('password')
->password()
Expand Down

0 comments on commit c4a6734

Please sign in to comment.