Skip to content

Commit

Permalink
fix: phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
taka-oyama committed May 24, 2022
1 parent e3f9ce3 commit 4bb6b5b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/Colopl/Spanner/Concerns/ManagesStaleReads.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ trait ManagesStaleReads
* @param string $query
* @param array<string, mixed> $bindings
* @param TimestampBoundInterface|null $timestampBound
* @return Generator
* @return Generator<int, list<mixed>|null>
*/
public function cursorWithTimestampBound($query, $bindings = [], TimestampBoundInterface $timestampBound = null): Generator
{
return $this->run($query, $bindings, function ($query, $bindings) use ($timestampBound) {
if ($this->pretending()) {
return call_user_func(function() { yield from []; });
return call_user_func(function() {
yield from [];
});
}

$options = ['parameters' => $this->prepareBindings($bindings)];
Expand All @@ -50,7 +52,7 @@ public function cursorWithTimestampBound($query, $bindings = [], TimestampBoundI
/**
* @param string $query
* @param array $bindings
* @param TimestampBoundInterface $timestampBound
* @param TimestampBoundInterface|null $timestampBound
* @return array
* @throws Throwable
*/
Expand All @@ -62,19 +64,16 @@ public function selectWithTimestampBound($query, $bindings = [], TimestampBoundI
}

/**
* @param string $query
* @param array $bindings
* @param TimestampBoundInterface $timestampBound
* @return array|null
* @throws Throwable
* @param string $query
* @param array<string, mixed> $bindings
* @param TimestampBoundInterface|null $timestampBound
* @return array<mixed>|null
*/
public function selectOneWithTimestampBound($query, $bindings = [], TimestampBoundInterface $timestampBound = null): ?array
{
$result = $this->withSessionNotFoundHandling(function () use ($query, $bindings, $timestampBound) {
return $this->withSessionNotFoundHandling(function () use ($query, $bindings, $timestampBound) {
return $this->cursorWithTimestampBound($query, $bindings, $timestampBound)->current();
});
assert(is_null($result) || is_array($result));
return $result;
}
}

0 comments on commit 4bb6b5b

Please sign in to comment.