Skip to content

Commit

Permalink
Fix hasSelects when no selects have been added
Browse files Browse the repository at this point in the history
Closes #742
  • Loading branch information
stevebauman committed Oct 25, 2024
1 parent 9e1f890 commit 207c727
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ public function clearFilters(): static
*/
public function hasSelects(): bool
{
return count($this->columns) > 0;
return count($this->columns ?? []) > 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public function test_has_selects()
{
$b = $this->newBuilder();

$this->assertFalse($b->hasSelects());

$b->select('test');

$this->assertTrue($b->hasSelects());
Expand Down

0 comments on commit 207c727

Please sign in to comment.