Skip to content

Commit

Permalink
chore: fix stan errors (#214)
Browse files Browse the repository at this point in the history
chore/stan-errors
  • Loading branch information
taka-oyama committed Jun 3, 2024
1 parent a65f680 commit 8ab4279
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
parameters:
level: max
checkMissingIterableValueType: false
paths:
- src
ignoreErrors:
- identifier: missingType.iterableValue
- '#^Access to an undefined property Illuminate\\Support\\Fluent.*$#'
- '#^Call to an undefined method Illuminate\\Support\\Fluent.*$#'
- '#^Access to an undefined property Colopl\\Spanner\\Schema\\IndexDefinition.*$#'
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ protected function escapeArray(array $value, bool $binary): string
{
if (array_is_list($value)) {
$escaped = array_map(function (mixed $v) use ($binary): string {
return !is_array($v)
return is_scalar($v)
? $this->escape($v, $binary)
: throw new LogicException('Nested arrays are not supported by Cloud Spanner');
}, $value);
Expand Down
3 changes: 2 additions & 1 deletion src/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace Colopl\Spanner\Eloquent;

use Illuminate\Contracts\Database\Eloquent\Builder as BuilderContract;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\Relation;
Expand Down Expand Up @@ -44,7 +45,7 @@ class Model extends BaseModel
* @param BaseModel|Relation $query
* @param mixed $value
* @param string|null $field
* @return Relation
* @return BuilderContract
*/
public function resolveRouteBindingQuery($query, $value, $field = null)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Schema/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,7 @@ public function compileDropSequenceIfExists(Blueprint $blueprint, object $comman
protected function formatSequenceOptions(mixed $definition): string
{
$optionAsStrings = Arr::map($definition->getOptions(), function (mixed $v, string $k): string {
return Str::snake($k) . '=' . match (get_debug_type($v)) {
'string' => $this->quoteString($v),
default => $v,
};
return Str::snake($k) . '=' . (is_string($v) ? $this->quoteString($v) : $v);
});
return 'options (' . implode(', ', $optionAsStrings) . ')';
}
Expand Down

0 comments on commit 8ab4279

Please sign in to comment.