Skip to content

[12.x] Improve migration types#58561

Merged
taylorotwell merged 11 commits into
laravel:12.xfrom
shaedrich:improve-migration-blueprint-types
Jan 30, 2026
Merged

[12.x] Improve migration types#58561
taylorotwell merged 11 commits into
laravel:12.xfrom
shaedrich:improve-migration-blueprint-types

Conversation

@shaedrich

Copy link
Copy Markdown
Contributor

Benefits

✅ Improved static analysis
✅ Improved type inference
✅ Increased type coverage

Highlights

  • Closures with argument and return types
  • Union string literals where possible
  • Array and object shapes
  • Class string
  • Narrowed integers

@shaedrich

shaedrich commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Test failures seem to be unrelated to the changes of this PR (the static analysis error will be fixed with #58562)

@taylorotwell taylorotwell merged commit b7d3dfc into laravel:12.x Jan 30, 2026
23 of 70 checks passed
@shaedrich shaedrich deleted the improve-migration-blueprint-types branch January 30, 2026 23:33
@rforced

rforced commented Feb 4, 2026

Copy link
Copy Markdown

@shaedrich I'm now seeing this error when running larastan after this upgrade. Any ideas?


Line database/migrations/2022_06_13_191522_create_team_user_table.php


15 Call to an undefined method Illuminate\Database\Schema\ForeignKeyDefinition::onDelete().
🪪 method.notFound
16 Call to an undefined method Illuminate\Database\Schema\ForeignKeyDefinition::onDelete().
🪪 method.notFound


@shaedrich

shaedrich commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

@rforced Thanks for reporting this! 👍🏻

Looked good to me at first, but turns out, @method type annotations are a little more fragile than others 😅

And sorry for the inconvenience 😬

@jackbayliss

Copy link
Copy Markdown
Contributor

@shaedrich Good day sir!

The lock stuff here is making my PHPstorm not show whats allowed

Screenshot 2026-03-26 at 15 37 23

I thought i'd @ you cause I'm sure you have the answer for it :D its probably fine but I found it weird :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants