Skip to content

Commit f15c853

Browse files
committed
Fix $this / static return
1 parent 5f9c9ab commit f15c853

File tree

2 files changed

+79
-79
lines changed

2 files changed

+79
-79
lines changed

src/DataTableAbstract.php

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static function canCreate($source)
167167
* Factory method, create and return an instance for the DataTable engine.
168168
*
169169
* @param mixed $source
170-
* @return static
170+
* @return $this
171171
*/
172172
public static function create($source)
173173
{
@@ -178,11 +178,11 @@ public static function create($source)
178178
/**
179179
* @param string|array $columns
180180
* @param string|\Yajra\DataTables\Contracts\Formatter $formatter
181-
* @return static
181+
* @return $this
182182
*
183183
* @throws \Yajra\DataTables\Exceptions\Exception
184184
*/
185-
public function formatColumn($columns, $formatter): self
185+
public function formatColumn($columns, $formatter): static
186186
{
187187
if (is_string($formatter) && class_exists($formatter)) {
188188
$formatter = app($formatter);
@@ -205,9 +205,9 @@ public function formatColumn($columns, $formatter): self
205205
* @param string $name
206206
* @param string|callable|Formatter $content
207207
* @param bool|int $order
208-
* @return static
208+
* @return $this
209209
*/
210-
public function addColumn($name, $content, $order = false): self
210+
public function addColumn($name, $content, $order = false): static
211211
{
212212
$this->extraColumns[] = $name;
213213

@@ -219,9 +219,9 @@ public function addColumn($name, $content, $order = false): self
219219
/**
220220
* Add DT row index column on response.
221221
*
222-
* @return static
222+
* @return $this
223223
*/
224-
public function addIndexColumn(): self
224+
public function addIndexColumn(): static
225225
{
226226
$this->columnDef['index'] = true;
227227

@@ -233,9 +233,9 @@ public function addIndexColumn(): self
233233
*
234234
* @param string $name
235235
* @param string|callable $content
236-
* @return static
236+
* @return $this
237237
*/
238-
public function editColumn($name, $content): self
238+
public function editColumn($name, $content): static
239239
{
240240
$this->columnDef['edit'][] = ['name' => $name, 'content' => $content];
241241

@@ -245,9 +245,9 @@ public function editColumn($name, $content): self
245245
/**
246246
* Remove column from collection.
247247
*
248-
* @return static
248+
* @return $this
249249
*/
250-
public function removeColumn(): self
250+
public function removeColumn(): static
251251
{
252252
$names = func_get_args();
253253
$this->columnDef['excess'] = array_merge($this->getColumnsDefinition()['excess'], $names);
@@ -272,9 +272,9 @@ protected function getColumnsDefinition(): array
272272
* Get only selected columns in response.
273273
*
274274
* @param array $columns
275-
* @return static
275+
* @return $this
276276
*/
277-
public function only(array $columns = []): self
277+
public function only(array $columns = []): static
278278
{
279279
$this->columnDef['only'] = $columns;
280280

@@ -285,9 +285,9 @@ public function only(array $columns = []): self
285285
* Declare columns to escape values.
286286
*
287287
* @param string|array $columns
288-
* @return static
288+
* @return $this
289289
*/
290-
public function escapeColumns($columns = '*'): self
290+
public function escapeColumns($columns = '*'): static
291291
{
292292
$this->columnDef['escape'] = $columns;
293293

@@ -298,9 +298,9 @@ public function escapeColumns($columns = '*'): self
298298
* Add a makeHidden() to the row object.
299299
*
300300
* @param array $attributes
301-
* @return static
301+
* @return $this
302302
*/
303-
public function makeHidden(array $attributes = []): self
303+
public function makeHidden(array $attributes = []): static
304304
{
305305
$hidden = (array) Arr::get($this->columnDef, 'hidden', []);
306306
$this->columnDef['hidden'] = array_merge_recursive($hidden, $attributes);
@@ -312,9 +312,9 @@ public function makeHidden(array $attributes = []): self
312312
* Add a makeVisible() to the row object.
313313
*
314314
* @param array $attributes
315-
* @return static
315+
* @return $this
316316
*/
317-
public function makeVisible(array $attributes = []): self
317+
public function makeVisible(array $attributes = []): static
318318
{
319319
$visible = (array) Arr::get($this->columnDef, 'visible', []);
320320
$this->columnDef['visible'] = array_merge_recursive($visible, $attributes);
@@ -328,9 +328,9 @@ public function makeVisible(array $attributes = []): self
328328
*
329329
* @param array $columns
330330
* @param bool $merge
331-
* @return static
331+
* @return $this
332332
*/
333-
public function rawColumns(array $columns, $merge = false): self
333+
public function rawColumns(array $columns, $merge = false): static
334334
{
335335
if ($merge) {
336336
/** @var array[] $config */
@@ -349,9 +349,9 @@ public function rawColumns(array $columns, $merge = false): self
349349
* result: <tr class="output_from_your_template">.
350350
*
351351
* @param string|callable $content
352-
* @return static
352+
* @return $this
353353
*/
354-
public function setRowClass($content): self
354+
public function setRowClass($content): static
355355
{
356356
$this->templates['DT_RowClass'] = $content;
357357

@@ -363,9 +363,9 @@ public function setRowClass($content): self
363363
* result: <tr id="output_from_your_template">.
364364
*
365365
* @param string|callable $content
366-
* @return static
366+
* @return $this
367367
*/
368-
public function setRowId($content): self
368+
public function setRowId($content): static
369369
{
370370
$this->templates['DT_RowId'] = $content;
371371

@@ -376,9 +376,9 @@ public function setRowId($content): self
376376
* Set DT_RowData templates.
377377
*
378378
* @param array $data
379-
* @return static
379+
* @return $this
380380
*/
381-
public function setRowData(array $data): self
381+
public function setRowData(array $data): static
382382
{
383383
$this->templates['DT_RowData'] = $data;
384384

@@ -390,9 +390,9 @@ public function setRowData(array $data): self
390390
*
391391
* @param string $key
392392
* @param string|callable $value
393-
* @return static
393+
* @return $this
394394
*/
395-
public function addRowData($key, $value): self
395+
public function addRowData($key, $value): static
396396
{
397397
$this->templates['DT_RowData'][$key] = $value;
398398

@@ -404,9 +404,9 @@ public function addRowData($key, $value): self
404404
* result: <tr attr1="attr1" attr2="attr2">.
405405
*
406406
* @param array $data
407-
* @return static
407+
* @return $this
408408
*/
409-
public function setRowAttr(array $data): self
409+
public function setRowAttr(array $data): static
410410
{
411411
$this->templates['DT_RowAttr'] = $data;
412412

@@ -418,9 +418,9 @@ public function setRowAttr(array $data): self
418418
*
419419
* @param string $key
420420
* @param string|callable $value
421-
* @return static
421+
* @return $this
422422
*/
423-
public function addRowAttr($key, $value): self
423+
public function addRowAttr($key, $value): static
424424
{
425425
$this->templates['DT_RowAttr'][$key] = $value;
426426

@@ -432,9 +432,9 @@ public function addRowAttr($key, $value): self
432432
*
433433
* @param mixed $key
434434
* @param mixed $value
435-
* @return static
435+
* @return $this
436436
*/
437-
public function with($key, $value = ''): self
437+
public function with($key, $value = ''): static
438438
{
439439
if (is_array($key)) {
440440
$this->appends = $key;
@@ -452,9 +452,9 @@ public function with($key, $value = ''): self
452452
*
453453
* @param string $key
454454
* @param callable $value
455-
* @return static
455+
* @return $this
456456
*/
457-
public function withQuery($key, callable $value): self
457+
public function withQuery($key, callable $value): static
458458
{
459459
$this->appends[$key] = $value;
460460

@@ -465,9 +465,9 @@ public function withQuery($key, callable $value): self
465465
* Override default ordering method with a closure callback.
466466
*
467467
* @param callable $closure
468-
* @return static
468+
* @return $this
469469
*/
470-
public function order(callable $closure): self
470+
public function order(callable $closure): static
471471
{
472472
$this->orderCallback = $closure;
473473

@@ -478,9 +478,9 @@ public function order(callable $closure): self
478478
* Update list of columns that is not allowed for search/sort.
479479
*
480480
* @param array $blacklist
481-
* @return static
481+
* @return $this
482482
*/
483-
public function blacklist(array $blacklist): self
483+
public function blacklist(array $blacklist): static
484484
{
485485
$this->columnDef['blacklist'] = $blacklist;
486486

@@ -491,9 +491,9 @@ public function blacklist(array $blacklist): self
491491
* Update list of columns that is allowed for search/sort.
492492
*
493493
* @param string|array $whitelist
494-
* @return static
494+
* @return $this
495495
*/
496-
public function whitelist($whitelist = '*'): self
496+
public function whitelist($whitelist = '*'): static
497497
{
498498
$this->columnDef['whitelist'] = $whitelist;
499499

@@ -504,9 +504,9 @@ public function whitelist($whitelist = '*'): self
504504
* Set smart search config at runtime.
505505
*
506506
* @param bool $state
507-
* @return static
507+
* @return $this
508508
*/
509-
public function smart($state = true): self
509+
public function smart($state = true): static
510510
{
511511
$this->config->set('datatables.search.smart', $state);
512512

@@ -517,9 +517,9 @@ public function smart($state = true): self
517517
* Set starts_with search config at runtime.
518518
*
519519
* @param bool $state
520-
* @return static
520+
* @return $this
521521
*/
522-
public function startsWithSearch($state = true): self
522+
public function startsWithSearch($state = true): static
523523
{
524524
$this->config->set('datatables.search.starts_with', $state);
525525

@@ -530,9 +530,9 @@ public function startsWithSearch($state = true): self
530530
* Set multi_term search config at runtime.
531531
*
532532
* @param bool $multiTerm
533-
* @return static
533+
* @return $this
534534
*/
535-
public function setMultiTerm($multiTerm = true): self
535+
public function setMultiTerm($multiTerm = true): static
536536
{
537537
$this->config->set('datatables.search.multi_term', $multiTerm);
538538

@@ -543,9 +543,9 @@ public function setMultiTerm($multiTerm = true): self
543543
* Set total records manually.
544544
*
545545
* @param int $total
546-
* @return static
546+
* @return $this
547547
*/
548-
public function setTotalRecords($total): self
548+
public function setTotalRecords($total): static
549549
{
550550
$this->totalRecords = $total;
551551

@@ -556,9 +556,9 @@ public function setTotalRecords($total): self
556556
* Set filtered records manually.
557557
*
558558
* @param int $total
559-
* @return static
559+
* @return $this
560560
*/
561-
public function setFilteredRecords($total): self
561+
public function setFilteredRecords($total): static
562562
{
563563
$this->filteredRecords = $total;
564564

@@ -568,9 +568,9 @@ public function setFilteredRecords($total): self
568568
/**
569569
* Skip pagination as needed.
570570
*
571-
* @return static
571+
* @return $this
572572
*/
573-
public function skipPaging(): self
573+
public function skipPaging(): static
574574
{
575575
$this->skipPaging = true;
576576

@@ -581,9 +581,9 @@ public function skipPaging(): self
581581
* Push a new column name to blacklist.
582582
*
583583
* @param string $column
584-
* @return static
584+
* @return $this
585585
*/
586-
public function pushToBlacklist($column): self
586+
public function pushToBlacklist($column): static
587587
{
588588
if (! $this->isBlacklisted($column)) {
589589
$this->columnDef['blacklist'][] = $column;
@@ -647,9 +647,9 @@ abstract protected function defaultOrdering(): void;
647647
*
648648
* @param callable $callback
649649
* @param bool $globalSearch
650-
* @return static
650+
* @return $this
651651
*/
652-
public function filter(callable $callback, $globalSearch = false): self
652+
public function filter(callable $callback, $globalSearch = false): static
653653
{
654654
$this->autoFilter = $globalSearch;
655655
$this->isFilterApplied = true;
@@ -679,9 +679,9 @@ public function toJson($options = 0)
679679
* @param string $column
680680
* @param mixed $options
681681
* @param callable|null $builder
682-
* @return static
682+
* @return $this
683683
*/
684-
public function searchPane($column, $options, callable $builder = null): self
684+
public function searchPane($column, $options, callable $builder = null): static
685685
{
686686
$options = value($options);
687687

@@ -942,9 +942,9 @@ public function getLogger()
942942
* Set monolog/logger instance.
943943
*
944944
* @param \Psr\Log\LoggerInterface $logger
945-
* @return static
945+
* @return $this
946946
*/
947-
public function setLogger(LoggerInterface $logger): self
947+
public function setLogger(LoggerInterface $logger): static
948948
{
949949
$this->logger = $logger;
950950

0 commit comments

Comments
 (0)