-
Notifications
You must be signed in to change notification settings - Fork 14
fix: PHPStan errors #293
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
Merged
Merged
fix: PHPStan errors #293
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Script executed:
Repository: colopl/laravel-spanner
<shell_result>
Repository: colopl/laravel-spanner
Script execution failed with unrecoverable error: [CAPABILITY:RUN_SHELL_SCRIPT] Failed to clone repository colopl/laravel-spanner: Clone operation failed
</shell_result>
Laravel Schema Builder setResolver resolver signature custom
<web_search_result>
Signature: a Closure that receives the table name and the callback and must return a Blueprint instance (or subclass).
Example:
Code:
This is documented on the Schema Builder (blueprintResolver expects a Closure that returns a Blueprint) and in multiple examples showing returning new Custom/ExtendedBlueprint. [1][2]
Sources:
[1] Laravel Schema\Builder — blueprintResolver docs. [2] Example: custom/extended Blueprint usage (shows returning new CustomBlueprint).
</web_search_result>
colopl/laravel-spanner github schema builder resolver connection
<web_search_result>
Relevant code and docs:
Notes on how it ties together:
Links:
[1] GitHub repo — colopl/laravel-spanner.
[2] Packagist / package page (README & config examples).
[3] DeepWiki summary referencing src/Schema/Blueprint.php and src/Schema/Grammar.php.
If you want, I can open the exact GitHub source files and paste the class/file paths and key methods (blueprint resolver usage, Connection class methods) with direct code links.
</web_search_result>
site:github.com colopl/laravel-spanner setResolver resolver connection parameter
<web_search_result>
Use Laravel's connection resolver API to register a resolver for the spanner driver. Example (in a service provider boot method):
DB::resolverFor('spanner', function ($config, $name) {
// return a connection instance (new \Colopl\Spanner\Connection(...)) using $config/$name
});
References:
Sources:
[1] colopl/laravel-spanner — Packagist / README.
[2] Illuminate\Database\Connection — Laravel API (resolverFor / getResolver).
</web_search_result>
site:github.com/colopl/laravel-spanner "setResolver" OR "blueprintResolver" PHP code
<web_search_result>
I searched for occurrences of "setResolver" or "blueprintResolver" in the colopl/laravel-spanner repository on GitHub and did not find any matches. The repo exposes Spanner-specific schema/Blueprint features (see src/Schema/Blueprint.php), but those specific symbols do not appear in the codebase. [1][2]
Sources:
</web_search_result>
laravel-spanner src/Schema/Builder.php custom resolver implementation
<web_search_result>
Short answer: use the Builder::blueprintResolver callback to return your custom Blueprint (and pass the connection/grammar if needed). Example for colopl/laravel-spanner (or any Laravel driver):
- Create your custom Blueprint class (extend the package's Blueprint or Illuminate\Database\Schema\Blueprint):
getSchemaBuilder()->blueprintResolver(function ($table, $callback) { return new MyBlueprint($table, $callback); }); } Notes - The Builder::blueprintResolver method is the standard Laravel hook for replacing Blueprint. ([api.laravel.com](https://api.laravel.com/docs/11.x/Illuminate/Database/Schema/Builder.html?utm_source=openai)) - For colopl/laravel-spanner use the package Blueprint/Grammar classes as the base if you need Spanner-specific features; set resolver on the spanner connection's schema builder. ([packagist.org](https://packagist.org/packages/colopl/laravel-spanner?utm_source=openai)) If you want, tell me which Laravel and laravel-spanner versions you use and I’ll give a ready-to-drop-in code example for that exact version. Citations: - 1: https://api.laravel.com/docs/11.x/Illuminate/Database/Schema/Builder.html?utm_source=openai - 2: https://packagist.org/packages/colopl/laravel-spanner?utm_source=openai ---🤖 Prompt for AI Agents
``` In src/Schema/Builder.php around lines 107–112, the resolver is being invoked with ($this->connection, $table, $callback) which breaks compatibility with Laravel's documented blueprintResolver signature function($table, $callback); revert the invocation to call the resolver with ($table, $callback) so custom resolvers keep working, and if the connection must be available instead, update the setResolver API and all callers/tests and add a clear changelog entry documenting the breaking signature change. ```Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that Laravel 12.x changes resolver arguments.
composer.json require Laravel
^12.21now, so I thinks this change is allowed.https://github.com/colopl/laravel-spanner/blob/master/composer.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 926
@tyabu12, you're absolutely correct! Thank you for catching this. I've verified the Laravel framework code, and indeed:
Laravel 11.x resolver signature:
Laravel 12.x resolver signature:
Your change correctly updates the resolver invocation to match Laravel 12.x's new signature. My previous review comment was incorrect as it was based on the Laravel 11.x pattern. This is a legitimate upstream breaking change in the Laravel framework itself.
The change looks good! ✅
✏️ Learnings added