Skip to content

Commit 099f097

Browse files
committed
Remove instanceof where defined
1 parent ca6e706 commit 099f097

File tree

14 files changed

+31
-161
lines changed

14 files changed

+31
-161
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ phpunit.xml.bak
2121
phpstan.txt
2222
coverage.xml
2323
./tmp/**
24-
./*.php.bk
24+
./*.php.bk
25+
src/Views/Filters/Traits/IsExternalArrayFilter.php.bk
26+
.gitignore
27+
src/Views/Filters/Traits/IsExternalFilter.php.bk

phpstan.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ parameters:
1616
- identifier: argument.type
1717
- identifier: argument.templateType
1818
- identifier: new.static
19-
- identifier: trait.unused
20-
- identifier: booleanNot.alwaysTrue
21-
paths:
22-
- src/Views/Columns/Traits/HasDataTableComponent.php
23-
- identifier: notIdentical.alwaysTrue
24-
paths:
25-
- src/Traits/Filters/Helpers/FilterPillsHelpers.php
26-
- src/Traits/Helpers/CustomisationsHelpers.php
27-
- src/Traits/Helpers/QueryHelpers.php
28-
- src/Views/Columns/Traits/HasSlot.php
29-
- identifier: instanceof.alwaysTrue
30-
paths:
31-
- src/Traits/Helpers/ColumnHelpers.php
32-
- src/Views/Columns/Traits/HasFooter.php
33-
- src/Views/Columns/Traits/HasSecondaryHeader.php
3419
- identifier: function.alreadyNarrowedType
3520
paths:
3621
- src/Views/Filters/MultiSelectDropdownFilter.php

resources/views/components/tools/toolbar/toolbar.blade.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
@aware([ 'tableName','isTailwind','isBootstrap'])
1+
@aware([ 'tableName','isTailwind','isBootstrap', 'toolBarAttributes'])
22
@props([])
3-
@php($toolBarAttributes = $this->getToolBarAttributesBag())
43

54
<div
65
{{

resources/views/components/tools/tools.blade.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
@aware(['isTailwind','isBootstrap'])
2-
@php($toolsAttributes = $this->getToolsAttributes())
2+
@props(['toolsAttributes', 'toolBarAttributes'])
33

4-
@includeWhen(
5-
$this->hasConfigurableAreaFor('before-tools'),
6-
$this->getConfigurableAreaFor('before-tools'),
7-
$this->getParametersForConfigurableArea('before-tools')
8-
)
94

105
<div {{
116
$attributes->merge(['x-data' => 'tools($wire)'])->merge($toolsAttributes)
@@ -49,8 +44,3 @@
4944

5045
</div>
5146

52-
@includeWhen(
53-
$this->hasConfigurableAreaFor('after-tools'),
54-
$this->getConfigurableAreaFor('after-tools'),
55-
$this->getParametersForConfigurableArea('after-tools')
56-
)

resources/views/datatable.blade.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@
1515
@endif
1616

1717
@if($this->shouldShowTools())
18-
<x-livewire-tables::tools />
18+
19+
@includeWhen(
20+
$this->hasConfigurableAreaFor('before-tools'),
21+
$this->getConfigurableAreaFor('before-tools'),
22+
$this->getParametersForConfigurableArea('before-tools')
23+
)
24+
25+
<x-livewire-tables::tools :toolsAttributes="$this->getToolsAttributes()" :toolBarAttributes="$this->getToolBarAttributesBag()" />
26+
27+
28+
@includeWhen(
29+
$this->hasConfigurableAreaFor('after-tools'),
30+
$this->getConfigurableAreaFor('after-tools'),
31+
$this->getParametersForConfigurableArea('after-tools')
32+
)
33+
1934
@endif
2035

2136
@php($currentRows = isset($rows) ? $rows : $this->getRows)

src/Traits/Filters/Helpers/FilterPillsHelpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getAppliedFiltersWithValuesForPills(): array
6161
}
6262
}
6363

64-
return is_array($validatedValue) ? count($validatedValue) : $validatedValue !== null;
64+
return is_array($validatedValue) ? count($validatedValue) : true;
6565
}, ARRAY_FILTER_USE_BOTH);
6666
}
6767

src/Traits/Helpers/ColumnHelpers.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function setColumns(): void
2121
protected function setupColumns(): void
2222
{
2323
$this->columns = $this->columns
24-
->filter(fn ($column) => $column instanceof Column)
2524
->map(function (Column $column) {
2625
$column->setTheme($this->getTheme())
2726
->setHasTableRowUrl($this->hasTableRowUrl())

src/Traits/Helpers/CustomisationsHelpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait CustomisationsHelpers
99
*/
1010
public function hasExtends(): bool
1111
{
12-
return isset($this->extends) && $this->extends !== null;
12+
return isset($this->extends);
1313
}
1414

1515
public function getExtends(): ?string
@@ -22,7 +22,7 @@ public function getExtends(): ?string
2222
*/
2323
public function hasSection(): bool
2424
{
25-
return isset($this->section) && $this->section !== null;
25+
return isset($this->section);
2626
}
2727

2828
public function getSection(): ?string
@@ -35,7 +35,7 @@ public function getSection(): ?string
3535
*/
3636
public function hasSlot(): bool
3737
{
38-
return isset($this->slot) && $this->slot !== null;
38+
return isset($this->slot);
3939
}
4040

4141
public function getSlot(): ?string
@@ -48,7 +48,7 @@ public function getSlot(): ?string
4848
*/
4949
public function hasLayout(): bool
5050
{
51-
return isset($this->layout) && $this->layout !== null;
51+
return isset($this->layout);
5252
}
5353

5454
public function getLayout(): ?string

src/Traits/Helpers/QueryHelpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getBuilder(): Builder
2323

2424
public function hasPrimaryKey(): bool
2525
{
26-
return isset($this->primaryKey) && $this->primaryKey !== null;
26+
return isset($this->primaryKey);
2727
}
2828

2929
/**

src/Views/Columns/Traits/HasFooter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getNewFooterContents(mixed $rows): string|HtmlString
125125
*/
126126
public function getFooterFilter(?Filter $filter, array $filterGenericData): \Illuminate\Contracts\Foundation\Application|\Illuminate\View\Factory|\Illuminate\View\View|string
127127
{
128-
if ($filter !== null && $filter instanceof Filter) {
128+
if ($filter !== null) {
129129
return $filter->setFilterPosition('footer')->setGenericDisplayData($filterGenericData)->render();
130130
} else {
131131
throw new DataTableConfigurationException('The footer callback must be a closure, filter object, or filter key if using footerFilter().');

0 commit comments

Comments
 (0)