Skip to content

Commit 5c6219f

Browse files
authored
chore: fix stan errors (#214)
chore/stan-errors
1 parent 62c7ba2 commit 5c6219f

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
parameters:
22
level: max
3-
checkMissingIterableValueType: false
43
paths:
54
- src
65
ignoreErrors:
6+
- identifier: missingType.iterableValue
77
- '#^Access to an undefined property Illuminate\\Support\\Fluent.*$#'
88
- '#^Call to an undefined method Illuminate\\Support\\Fluent.*$#'
99
- '#^Access to an undefined property Colopl\\Spanner\\Schema\\IndexDefinition.*$#'

src/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ protected function escapeArray(array $value, bool $binary): string
459459
{
460460
if (array_is_list($value)) {
461461
$escaped = array_map(function (mixed $v) use ($binary): string {
462-
return !is_array($v)
462+
return is_scalar($v)
463463
? $this->escape($v, $binary)
464464
: throw new LogicException('Nested arrays are not supported by Cloud Spanner');
465465
}, $value);

src/Eloquent/Model.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace Colopl\Spanner\Eloquent;
1919

20+
use Illuminate\Contracts\Database\Eloquent\Builder as BuilderContract;
2021
use Illuminate\Database\Eloquent\Builder;
2122
use Illuminate\Database\Eloquent\Model as BaseModel;
2223
use Illuminate\Database\Eloquent\Relations\Relation;
@@ -44,7 +45,7 @@ class Model extends BaseModel
4445
* @param BaseModel|Relation $query
4546
* @param mixed $value
4647
* @param string|null $field
47-
* @return Relation
48+
* @return BuilderContract
4849
*/
4950
public function resolveRouteBindingQuery($query, $value, $field = null)
5051
{

src/Schema/Grammar.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,7 @@ public function compileDropSequenceIfExists(Blueprint $blueprint, object $comman
253253
protected function formatSequenceOptions(mixed $definition): string
254254
{
255255
$optionAsStrings = Arr::map($definition->getOptions(), function (mixed $v, string $k): string {
256-
return Str::snake($k) . '=' . match (get_debug_type($v)) {
257-
'string' => $this->quoteString($v),
258-
default => $v,
259-
};
256+
return Str::snake($k) . '=' . (is_string($v) ? $this->quoteString($v) : $v);
260257
});
261258
return 'options (' . implode(', ', $optionAsStrings) . ')';
262259
}

0 commit comments

Comments
 (0)