Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function isStrictModeEnabled(): bool
return $this->strictMode;
}

public function enableStrictMode(bool $enabled = true): self
public function enableStrictMode(bool $enabled = true): static
{
$this->strictMode = $enabled;
return $this;
Expand All @@ -75,7 +75,7 @@ public function getFields(): array
/**
* @throws InvalidArgumentException if fields[] is empty or one field is empty or blank.
*/
public function fields(string ...$fields): self
public function fields(string ...$fields): static
{
if (empty($fields)) {
throw new InvalidArgumentException("fields cannot be empty");
Expand Down Expand Up @@ -104,7 +104,7 @@ public function fields(string ...$fields): self
* @throws InvalidArgumentException if no fields are passed
* or any field is empty or blank.
*/
public function addFields(string ...$fields): self
public function addFields(string ...$fields): static
{
if (empty($fields)) {
throw new InvalidArgumentException("fields cannot be empty");
Expand All @@ -126,7 +126,7 @@ public function getExcludedFields(): array
/**
* @throws InvalidArgumentException if fields[] is empty or one field is empty or blank.
*/
public function exclude(string ...$fields): self
public function exclude(string ...$fields): static
{
if (empty($fields)) {
throw new InvalidArgumentException("fields cannot be empty");
Expand All @@ -151,7 +151,7 @@ public function getConditions(): array
* @throws InvalidArgumentException if condition is empty or blank.
* @throws LogicException if a where() condition is already set.
*/
public function where(string $condition): self
public function where(string $condition): static
{
$condition = $this->validateAndTrimString(value: $condition, paramName: 'where condition');

Expand All @@ -168,7 +168,7 @@ public function where(string $condition): self
*
* @throws InvalidArgumentException if condition is empty or blank.
*/
public function andWhere(string $condition): self
public function andWhere(string $condition): static
{
$condition = $this->validateAndTrimString(value: $condition, paramName: 'andWhere condition');

Expand All @@ -188,7 +188,7 @@ public function andWhere(string $condition): self
* @throws InvalidArgumentException if condition is empty or blank.
* @throws LogicException if this is the first condition.
*/
public function orWhere(string $condition): self
public function orWhere(string $condition): static
{
$condition = $this->validateAndTrimString(value: $condition, paramName: 'orWhere condition');

Expand All @@ -210,7 +210,7 @@ public function getSortFields(): array
*
* @throws InvalidArgumentException if field is empty or blank.
*/
public function sort(string $field, SortDirection $direction = SortDirection::ASC): self
public function sort(string $field, SortDirection $direction = SortDirection::ASC): static
{
$field = $this->validateAndTrimString(value: $field, paramName: 'sort field');

Expand All @@ -228,7 +228,7 @@ public function getLimit(): ?int
*
* @throws InvalidArgumentException if limit is not a positive integer.
*/
public function limit(int $limit): self
public function limit(int $limit): static
{
QueryValidator::positiveInt($limit, 'limit');

Expand All @@ -246,7 +246,7 @@ public function getOffset(): ?int
*
* @throws InvalidArgumentException if offset is not a non-negative integer.
*/
public function offset(int $offset): self
public function offset(int $offset): static
{
QueryValidator::nonNegativeInt($offset, 'offset');

Expand All @@ -263,7 +263,7 @@ public function getSearchTerm(): ?string
/**
* @throws InvalidArgumentException if term is empty or blank.
*/
public function search(string $term): self
public function search(string $term): static
{
$term = $this->validateAndTrimString(value: $term, paramName: 'search term');

Expand Down Expand Up @@ -388,7 +388,7 @@ public function build(): string
* Clear the current query state.
* Resets all properties to their initial state.
*/
public function clear(): self
public function clear(): static
{
$this->fields = $this->exclude = $this->conditions = $this->sort = [];
$this->limit = $this->offset = $this->searchTerm = null;
Expand Down