Skip to content

Commit c17d045

Browse files
authored
Merge pull request #183 from yajra/fix-exception
fix: unnecessary exception thrown
2 parents 979ac47 + 9ce95f4 commit c17d045

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/Contracts/DataTableHtmlBuilder.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ interface DataTableHtmlBuilder
88
* Handle building of dataTables html.
99
*
1010
* @return \Yajra\DataTables\Html\Builder
11-
*
12-
* @throws \Exception
1311
*/
1412
public function handle();
1513
}

src/Html/DataTableHtml.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,24 @@
1010
*/
1111
abstract class DataTableHtml implements DataTableHtmlBuilder
1212
{
13-
/**
14-
* @var \Yajra\DataTables\Html\Builder|null
15-
*/
1613
protected ?Builder $htmlBuilder = null;
1714

18-
/**
19-
* @return \Yajra\DataTables\Html\Builder
20-
*
21-
* @throws \Exception
22-
*/
2315
public static function make(): Builder
2416
{
2517
if (func_get_args()) {
2618
return (new static(...func_get_args()))->handle();
2719
}
2820

29-
return app(static::class)->handle();
21+
/** @var static $html */
22+
$html = app(static::class);
23+
24+
return $html->handle();
3025
}
3126

3227
/**
3328
* @param string $method
3429
* @param mixed $parameters
35-
* @return mixed
30+
* @return \Yajra\DataTables\Html\Builder
3631
*
3732
* @throws \Exception
3833
*/
@@ -45,9 +40,6 @@ public function __call(string $method, $parameters)
4540
throw new BadMethodCallException("Method {$method} does not exists");
4641
}
4742

48-
/**
49-
* @return \Yajra\DataTables\Html\Builder
50-
*/
5143
protected function getHtmlBuilder(): Builder
5244
{
5345
if ($this->htmlBuilder) {
@@ -57,10 +49,6 @@ protected function getHtmlBuilder(): Builder
5749
return $this->htmlBuilder = app(Builder::class);
5850
}
5951

60-
/**
61-
* @param \Yajra\DataTables\Html\Builder $builder
62-
* @return static
63-
*/
6452
public function setHtmlBuilder(Builder $builder): static
6553
{
6654
$this->htmlBuilder = $builder;

0 commit comments

Comments
 (0)