From 9130acd08c8434804e505b871da92fad1aafa312 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Tue, 10 Jul 2018 17:54:04 -0500 Subject: [PATCH] Use assert() instead of comments --- src/StatementPool.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/StatementPool.php b/src/StatementPool.php index 0b8ad4f..b75aaa2 100644 --- a/src/StatementPool.php +++ b/src/StatementPool.php @@ -54,8 +54,8 @@ abstract class StatementPool implements Statement $idleTimeout = ((int) ($pool->getIdleTimeout() / 10)) ?: 1; while (!$statements->isEmpty()) { - /** @var Statement $statement */ $statement = $statements->bottom(); + \assert($statement instanceof Statement); if ($statement->lastUsedAt() + $idleTimeout > $now) { return; @@ -134,15 +134,17 @@ abstract class StatementPool implements Statement protected function pop(): \Generator { while (!$this->statements->isEmpty()) { - /** @var Statement $statement */ $statement = $this->statements->shift(); + \assert($statement instanceof Statement); if ($statement->isAlive()) { return $statement; } } - return yield ($this->prepare)($this->sql); + $statement = yield ($this->prepare)($this->sql); + \assert($statement instanceof Statement); + return $statement; } /** {@inheritdoc} */