Skip to content

Commit 0c2b587

Browse files
yajragithub-actions[bot]
authored andcommitted
fix: pint
1 parent 5c5aa0f commit 0c2b587

File tree

5 files changed

+18
-53
lines changed

5 files changed

+18
-53
lines changed

src/Jobs/DataTableExportJob.php

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
use Yajra\DataTables\Html\Column;
3232
use Yajra\DataTables\Services\DataTable;
3333

34-
class DataTableExportJob implements ShouldQueue, ShouldBeUnique
34+
class DataTableExportJob implements ShouldBeUnique, ShouldQueue
3535
{
36+
use Batchable;
3637
use Dispatchable;
3738
use InteractsWithQueue;
3839
use Queueable;
3940
use SerializesModels;
40-
use Batchable;
4141

4242
public string $dataTable = '';
4343

@@ -55,10 +55,7 @@ class DataTableExportJob implements ShouldQueue, ShouldBeUnique
5555
/**
5656
* Create a new job instance.
5757
*
58-
* @param array $dataTable
59-
* @param array $request
6058
* @param int|string $user
61-
* @param string $sheetName
6259
*/
6360
public function __construct(array $dataTable, array $request, $user, string $sheetName = 'Sheet1')
6461
{
@@ -194,16 +191,12 @@ public function handle()
194191
}
195192
}
196193

197-
/**
198-
* @return string
199-
*/
200194
protected function getDisk(): string
201195
{
202196
return strval(config('datatables-export.disk', 'local'));
203197
}
204198

205199
/**
206-
* @param \Yajra\DataTables\Services\DataTable $dataTable
207200
* @return \Illuminate\Support\Collection<array-key, Column>
208201
*/
209202
protected function getExportableColumns(DataTable $dataTable): Collection
@@ -213,18 +206,11 @@ protected function getExportableColumns(DataTable $dataTable): Collection
213206
return $columns->filter(fn (Column $column) => $column->exportable);
214207
}
215208

216-
/**
217-
* @return bool
218-
*/
219209
protected function usesLazyMethod(): bool
220210
{
221211
return config('datatables-export.method', 'lazy') === 'lazy';
222212
}
223213

224-
/**
225-
* @param \Yajra\DataTables\Html\Column $column
226-
* @return bool
227-
*/
228214
protected function wantsText(Column $column): bool
229215
{
230216
if (! isset($column['exportFormat'])) {
@@ -234,10 +220,6 @@ protected function wantsText(Column $column): bool
234220
return in_array($column['exportFormat'], (array) config('datatables-export.text_formats', ['@']));
235221
}
236222

237-
/**
238-
* @param \Yajra\DataTables\Html\Column $column
239-
* @return bool
240-
*/
241223
protected function wantsDateFormat(Column $column): bool
242224
{
243225
if (! isset($column['exportFormat'])) {
@@ -250,18 +232,13 @@ protected function wantsDateFormat(Column $column): bool
250232
return in_array($column['exportFormat'], $formats);
251233
}
252234

253-
/**
254-
* @param \Yajra\DataTables\Html\Column $column
255-
* @return bool
256-
*/
257235
protected function wantsNumeric(Column $column): bool
258236
{
259237
return Str::contains($column->exportFormat, ['0', '#']);
260238
}
261239

262240
/**
263241
* @param int|bool|string|null $value
264-
* @return bool
265242
*/
266243
protected function isNumeric($value): bool
267244
{
@@ -273,24 +250,17 @@ protected function isNumeric($value): bool
273250
return is_numeric($value);
274251
}
275252

276-
/**
277-
* @return string
278-
*/
279253
protected function getS3Disk(): string
280254
{
281255
return strval(config('datatables-export.s3_disk', ''));
282256
}
283257

284-
/**
285-
* @param array $data
286-
* @return void
287-
*/
288258
public function sendResults(array $data): void
289259
{
290260
Mail::send('datatables-export::export-email', $data, function ($message) use ($data) {
291261
$message->attach($data['path']);
292262
$message->to($data['email'])
293-
->subject('Export Report');
263+
->subject('Export Report');
294264
$message->from(config('datatables-export.mail_from'));
295265
});
296266
}

src/Livewire/ExportButtonComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function downloadExport(): StreamedResponse
7878
{
7979
if ($this->getS3Disk()) {
8080
return Storage::disk($this->getS3Disk())
81-
->download($this->batchJobId.'.'.$this->getType(), $this->getFilename());
81+
->download($this->batchJobId.'.'.$this->getType(), $this->getFilename());
8282
}
8383

8484
return Storage::disk($this->getDisk())->download($this->batchJobId.'.'.$this->getType(), $this->getFilename());

src/WithExportQueue.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ trait WithExportQueue
1414
/**
1515
* Process dataTables needed render output.
1616
*
17-
* @param string|null $view
18-
* @param array $data
19-
* @param array $mergeData
2017
* @return mixed
2118
*
2219
* @throws \Throwable
2320
*/
24-
public function render(string $view = null, array $data = [], array $mergeData = [])
21+
public function render(?string $view = null, array $data = [], array $mergeData = [])
2522
{
2623
if (request()->ajax() && request('action') == 'exportQueue') {
2724
return $this->exportQueue();
@@ -33,7 +30,6 @@ public function render(string $view = null, array $data = [], array $mergeData =
3330
/**
3431
* Create and run batch job.
3532
*
36-
* @return string
3733
*
3834
* @throws \Throwable
3935
*/
@@ -54,8 +50,6 @@ public function exportQueue(): string
5450
/**
5551
* Default sheet name.
5652
* Character limit 31.
57-
*
58-
* @return string
5953
*/
6054
protected function sheetName(): string
6155
{

tests/DataTables/UsersDataTable.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ class UsersDataTable extends DataTable
1515

1616
/**
1717
* @param \Illuminate\Database\Eloquent\Builder<\Yajra\DataTables\Exports\Tests\Models\User> $query
18-
* @return \Yajra\DataTables\EloquentDataTable
1918
*/
2019
public function dataTable(Builder $query): EloquentDataTable
2120
{
2221
return (new EloquentDataTable($query))->setRowId('id');
2322
}
2423

2524
/**
26-
* @param \Yajra\DataTables\Exports\Tests\Models\User $user
2725
* @return \Illuminate\Database\Eloquent\Builder<\Yajra\DataTables\Exports\Tests\Models\User>
2826
*/
2927
public function query(User $user): Builder
@@ -34,12 +32,12 @@ public function query(User $user): Builder
3432
public function html(): \Yajra\DataTables\Html\Builder
3533
{
3634
return parent::html()
37-
->setTableId('users-table')
38-
->minifiedAjax()
39-
->columns([
40-
Column::make('id'),
41-
Column::make('name'),
42-
Column::make('email'),
43-
]);
35+
->setTableId('users-table')
36+
->minifiedAjax()
37+
->columns([
38+
Column::make('id'),
39+
Column::make('name'),
40+
Column::make('email'),
41+
]);
4442
}
4543
}

tests/TestCase.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ protected function seedDatabase(): void
8383
*
8484
* @param \Illuminate\Foundation\Application $app
8585
*/
86-
protected function getEnvironmentSetUp($app) {
86+
protected function getEnvironmentSetUp($app)
87+
{
8788
$app['config']->set('app.debug', true);
8889
$app['config']->set('queue.default', 'sync');
8990
$app['config']->set('database.default', 'sqlite');
@@ -96,7 +97,8 @@ protected function getEnvironmentSetUp($app) {
9697
View::addNamespace('tests', __DIR__.'/views');
9798
}
9899

99-
protected function getPackageProviders($app): array {
100+
protected function getPackageProviders($app): array
101+
{
100102
return [
101103
\Yajra\DataTables\DataTablesServiceProvider::class,
102104
\Yajra\DataTables\HtmlServiceProvider::class,
@@ -105,7 +107,8 @@ protected function getPackageProviders($app): array {
105107
];
106108
}
107109

108-
protected function getPackageAliases($app): array {
110+
protected function getPackageAliases($app): array
111+
{
109112
return [
110113
'DataTables' => \Yajra\DataTables\Facades\DataTables::class,
111114
];

0 commit comments

Comments
 (0)