Use assert() instead of comments
This commit is contained in:
parent
f50c02e39f
commit
9130acd08c
@ -54,8 +54,8 @@ abstract class StatementPool implements Statement
|
|||||||
$idleTimeout = ((int) ($pool->getIdleTimeout() / 10)) ?: 1;
|
$idleTimeout = ((int) ($pool->getIdleTimeout() / 10)) ?: 1;
|
||||||
|
|
||||||
while (!$statements->isEmpty()) {
|
while (!$statements->isEmpty()) {
|
||||||
/** @var Statement $statement */
|
|
||||||
$statement = $statements->bottom();
|
$statement = $statements->bottom();
|
||||||
|
\assert($statement instanceof Statement);
|
||||||
|
|
||||||
if ($statement->lastUsedAt() + $idleTimeout > $now) {
|
if ($statement->lastUsedAt() + $idleTimeout > $now) {
|
||||||
return;
|
return;
|
||||||
@ -134,15 +134,17 @@ abstract class StatementPool implements Statement
|
|||||||
protected function pop(): \Generator
|
protected function pop(): \Generator
|
||||||
{
|
{
|
||||||
while (!$this->statements->isEmpty()) {
|
while (!$this->statements->isEmpty()) {
|
||||||
/** @var Statement $statement */
|
|
||||||
$statement = $this->statements->shift();
|
$statement = $this->statements->shift();
|
||||||
|
\assert($statement instanceof Statement);
|
||||||
|
|
||||||
if ($statement->isAlive()) {
|
if ($statement->isAlive()) {
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return yield ($this->prepare)($this->sql);
|
$statement = yield ($this->prepare)($this->sql);
|
||||||
|
\assert($statement instanceof Statement);
|
||||||
|
return $statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritdoc} */
|
/** {@inheritdoc} */
|
||||||
|
Loading…
Reference in New Issue
Block a user