From c21ad52052fc7ba79e088cb73bfcff41a5774f52 Mon Sep 17 00:00:00 2001 From: Go Kudo Date: Wed, 25 Dec 2024 12:23:51 +0900 Subject: [PATCH] chore: better PHPStan support (#244) --- CHANGELOG.md | 3 ++- phpstan.neon | 4 ++-- src/Connection.php | 3 ++- src/Query/Builder.php | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09ba977..8d692f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# v8.3.0 (2024-11-08) +# v8.3.0 (2024-12-25) - add support for full text search (#235) - add support for IDENTITY columns (#243) @@ -10,6 +10,7 @@ - add support for `Query\Builder::whereNotInUnnest(...)` (#225) - `Query\Builder::whereIn` will now wrap values in `UNNEST` if the number of values exceeds the limit (950). (#226) - Commit options can now be set through config or through `Connection::setCommitOptions(...)` (#229) +- improve PHPStan support (#244) # v8.2.0 (2024-08-05) diff --git a/phpstan.neon b/phpstan.neon index bbfce75..4ce7c86 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,9 +13,9 @@ parameters: path: src/Connection.php - message: '#^Method Colopl\\Spanner\\Connection::selectWithOptions\(\) should return array but returns mixed\.$#' path: src/Connection.php - - message: "#^Method Colopl\\\\Spanner\\\\Connection\\:\\:cursor\\(\\) should return Generator\\ but returns Generator\\\\.$#" - path: src/Connection.php + - message: "#^Return type \\(Generator\\\\) of method Colopl\\\\Spanner\\\\Connection\\:\\:cursor\\(\\) should be compatible with return type \\(Generator\\\\) of method Illuminate\\\\Database\\\\Connection\\:\\:cursor\\(\\)$#" count: 1 + path: src/Connection.php - message: '#^Generator expects value type array, mixed given.$#' path: src/Connection.php count: 1 diff --git a/src/Connection.php b/src/Connection.php index 62a062c..b670ed7 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -252,7 +252,8 @@ public function select($query, $bindings = [], $useReadPdo = true): array } /** - * @inheritDoc + * {@inheritDoc} + * @return Generator> */ public function cursor($query, $bindings = [], $useReadPdo = true): Generator { diff --git a/src/Query/Builder.php b/src/Query/Builder.php index 67d3ada..e2cdfe2 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -23,8 +23,12 @@ use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Query\Builder as BaseBuilder; use Illuminate\Support\Arr; +use Illuminate\Support\Collection; use LogicException; +/** + * @method Collection> get($columns = ['*']) + */ class Builder extends BaseBuilder { use Concerns\SetsRequestTimeouts;