Skip to content

Fix interface union parsing after ::class references#3

Merged
daniel-cannon merged 7 commits intoalphafrom
fbg-interface-unions-fix
Mar 23, 2026
Merged

Fix interface union parsing after ::class references#3
daniel-cannon merged 7 commits intoalphafrom
fbg-interface-unions-fix

Conversation

@daniel-cannon
Copy link
Copy Markdown
Member

Summary

  • stop treating ::class constant fetches as real class declarations when locating the model class token
  • add a regression fixture and test for an attribute containing both ParentAnimal::class and an enum case
  • keep the recent chunk-boundary fix intact while restoring correct interface-union generation for real Laravel models

Context

This fixes a regression introduced by the newer class declaration parser.

In consuming apps like fbg-app, models with attributes such as:

  • #[MentionableDto(MemberData::class, MentionablePrefix::Member, 'name')]

could be parsed incorrectly, causing the generator to treat MentionablePrefix as the model class and emit invalid unions such as App\\Models\\MentionablePrefix.

Effect

This restores correct output for interface unions like Historiable, FileUploadable, Invoiceable, and Orderer in real app usage.

@daniel-cannon daniel-cannon self-assigned this Mar 23, 2026
@daniel-cannon daniel-cannon merged commit c585090 into alpha Mar 23, 2026
6 checks passed
@daniel-cannon daniel-cannon deleted the fbg-interface-unions-fix branch March 23, 2026 17:16
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