Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(SelectQuery): refine Psalm integer types on query bounds #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
roxblnfk merged 1 commit into 2.x from bugfix/runchunks-reject-non-positive-limit
Jun 11, 2026
Merged
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
24 changes: 17 additions & 7 deletions src/Query/SelectQuery.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public function limit(?int $limit = null): self
return $this;
}

/**
* @return int<0, max>|null
*/
public function getLimit(): ?int
{
return $this->limit;
Expand All @@ -271,6 +274,9 @@ public function offset(?int $offset = null): self
return $this;
}

/**
* @return int<0, max>|null
*/
public function getOffset(): ?int
{
return $this->offset;
Expand All @@ -294,6 +300,8 @@ public function run(): StatementInterface
*
* You must return FALSE from walk function to stop chunking.
*
* @param int<1, max> $limit Chunk size.
*
* @throws \Throwable
*/
public function runChunks(int $limit, callable $callback): void
Expand Down Expand Up @@ -324,7 +332,9 @@ public function runChunks(int $limit, callable $callback): void
/**
* Count number of rows in query. Limit, offset, order by, group by values will be ignored.
*
* @psalm-param non-empty-string $column Column to count by (every column by default).
* @param non-empty-string $column Column to count by (every column by default).
*
* @return int<0, max>
*/
public function count(string $column = '*', bool $distinct = false): int
{
Expand All @@ -346,31 +356,31 @@ public function count(string $column = '*', bool $distinct = false): int
}

/**
* @psalm-param non-empty-string $column
* @param non-empty-string $column
*/
public function avg(string $column): mixed
{
return $this->runAggregate('AVG', $column);
}

/**
* @psalm-param non-empty-string $column
* @param non-empty-string $column
*/
public function max(string $column): mixed
{
return $this->runAggregate('MAX', $column);
}

/**
* @psalm-param non-empty-string $column
* @param non-empty-string $column
*/
public function min(string $column): mixed
{
return $this->runAggregate('MIN', $column);
}

/**
* @psalm-param non-empty-string $column
* @param non-empty-string $column
*/
public function sum(string $column): mixed
{
Expand Down Expand Up @@ -436,8 +446,8 @@ private function addOrder(string|FragmentInterface $field, ?string $order): self
}

/**
* @psalm-param non-empty-string $method
* @psalm-param non-empty-string $column
* @param non-empty-string $method
* @param non-empty-string $column
*/
private function runAggregate(string $method, string $column): mixed
{
Expand Down
Loading

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /