Repository navigation
Read migration columns from arrow function Schema::create() and Schema::table() callbacks - #2350
Merged
Merged
Conversation
…llbacks Schema::create(), Schema::table() and Blueprint::after() callbacks written as fn (Blueprint $table) => ... were ignored. Psalm's name resolver skips arrow function signatures, so the Blueprint parameter type check falls back to the written class name. Fixes #2338
Psalm's SimpleNameResolver skips ArrowFunction signatures; the written-name fallback in isForeignParamType() is a workaround until vimeo/psalm#14134 lands.
…xactly Pins the written-name fallback limits in a KnownLimitation test and documents them; see vimeo/psalm#14134.
Contributor
|
| Project | psalm-plugin-laravel |
| Branch | pr-2350 |
| Testbed | intel-v1 |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) | Peak Memory | Benchmark Result megabytes (MB) x 1e3 (Result Δ%) | Upper Boundary megabytes (MB) x 1e3 (Limit %) |
|---|---|---|---|---|---|---|
| monica | 📈 view plot 🚷 view threshold | 43.26 s(-1.45%)Baseline: 43.90 s | 47.76 s (90.58%) | 📈 view plot 🚷 view threshold | 1.16 MB x 1e3(+0.17%)Baseline: 1.15 MB x 1e3 | 1.21 MB x 1e3 (95.40%) |
Collaborator
Author
|
/psalm-delta all |
Contributor
✅ Types: unchanged · Performance: unchangedApps: all → 23
How to read this table
head 4c2d04c · base 2505648 (merge-base) · workflow run Informational only — never fails the PR. Pick apps with |
…backs Psalm now resolves class names in arrow function signatures (vimeo/psalm#14134), so the written-name fallback and its known limitations are gone: an imported foreign Blueprint is declined and an aliased Blueprint is accepted, exactly like closures.
Psalm 7.10.0 ships vimeo/psalm#14134, which the arrow function Blueprint callback check relies on.
- Bump vimeo/psalm to ^7.10.0 in composer.json and the tests.yml install step. - Psalm 7.10 narrows exhausted instanceof checks to never (vimeo/psalm#14048): widen the container resolutions of url, translator and view to mixed so the runtime guards stay honest, and drop the unreachable Model guard around ReflectionClass<Model>::newInstanceWithoutConstructor(). - Expect the InvalidArgument 7.10 reports for a numeric-string factory() count in FactoryCountInferenceTest.
Rector strips a plain @var mixed, which brought back the Psalm 7.10 TypeDoesNotContainType findings.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue to Solve
SchemaAggregatoronly readClosurecallbacks, so columns declared inSchema::create('tags', fn (Blueprint $table) => $table->string('name'))never reached the model schema and their properties were unknown.Related
Fixes #2338
Depends on #2355 (Require Psalm 7.10), merged into this branch: Psalm 7.10.0 resolves class names in arrow function signatures (vimeo/psalm#14134).
Solution Description
Schema::create(),Schema::table()andBlueprint::after()accept arrow functions; the expression body is read as a one-statement closure body.resolvedName, exactly like closures: an imported foreignBlueprintis declined, an aliaseduse ...\Blueprint as Bis accepted, fully qualified names resolve as written.Blueprint.Checklist
tests/Unit)