Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix stan errors #214

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -253,10 +253,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
Loading