Skip to content

Infer string keys for UUID and ULID models - #438

Open
shuvroroy wants to merge 1 commit into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-unique-string-ids
Open

Infer string keys for UUID and ULID models#438
shuvroroy wants to merge 1 commit into
PHPantom-dev:mainfrom
shuvroroy:feat/laravel-unique-string-ids

Conversation

@shuvroroy

Copy link
Copy Markdown
Contributor

Models using Laravel's HasUuids or HasUlids traits currently expose an implicit integer primary key. This change resolves that key as string, including traits composed through other traits or inherited from parent models, so completion, hover, and diagnostics agree with the model's identifier type.

Trait detection uses bounded traversal and avoids cloning class metadata. Custom primary-key names and existing property precedence are preserved. Includes regression tests, Laravel playground examples with runtime assertions, a changelog entry, and removal of the completed L12 backlog item.

Validation

  • Full Rust suite under cargo llvm-cov: 14,730 passed, 2 ignored.
  • Documentation tests: 1 passed, 10 ignored.
  • Added executable Rust lines: 47/47 covered (100%) against main.
  • cargo clippy --fix --allow-dirty -- -D warnings, cargo clippy --all-targets -- -D warnings, and cargo fmt --check pass.
  • PHP playground syntax checks and runtime assertions pass; Laravel runtime assertions pass (187 assertions).
  • Laravel analysis reports the three intentional demo errors and the existing named-slot closing-tag diagnostic. The slot issue is being addressed in a separate PR; this PR does not modify the Blade template.

Checklist

  • Updated docs/CHANGELOG.md.
  • Updated documentation and examples.
  • Added tests covering the behavior and edge cases.
  • Reviewed the code for correctness and performance.
  • Reviewed the documentation, comments, and commit description.

No config schema changes are required.

Recognize HasUuids and HasUlids through composed traits and parent models when resolving implicit primary keys. Preserve existing property precedence and custom key names.

Add provider and LSP regression tests, Laravel demos with runtime assertions, and changelog documentation. Remove the completed backlog item.
@shuvroroy shuvroroy changed the title feat(laravel): infer string keys for UUID and ULID models Infer string keys for UUID and ULID models Sep 9, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants