Skip to content

[12.x] Makes imports consistent - #59149

Merged
taylorotwell merged 1 commit into
12.xfrom
feat/makes-imports-consistent
Mar 10, 2026
Merged

taylorotwell merged 1 commit into
12.xfrom
feat/makes-imports-consistent

Conversation

@nunomaduro

Copy link
Copy Markdown
Member

More info: laravel/pint#425

@nunomaduro
nunomaduro marked this pull request as ready for review March 10, 2026 19:52
@taylorotwell
taylorotwell merged commit 156f129 into 12.x Mar 10, 2026
73 checks passed
@taylorotwell
taylorotwell deleted the feat/makes-imports-consistent branch March 17, 2026 15:17
jonagoldman pushed a commit to deplox/laravel-framework that referenced this pull request Apr 30, 2026
binaryfire added a commit to hypervel/components that referenced this pull request Sep 24, 2026
laravel/framework#59149 imports classes that the
mail, form request and rule stubs only mention in PHPDoc. The import
collides with a generated class of the same name, so make:mail
Attachment, make:request ValidationRule and make:rule
PotentiallyTranslatedString generate files PHP refuses to load. The
event stub had the same problem with Channel. Laravel has these bugs.

The mail, request and rule stubs keep their fully qualified PHPDoc
types, and the event stub now qualifies Channel as well.

The generator tests share a lint assertion. New tests generate each
colliding name for the plain, markdown and view mail stubs, the request
stub, both rule stubs and the event stub, and check that the result
compiles. The factory test uses the same assertion. The request, rule
and event generator tests also get their missing property and return
types.

Claude-Session: https://claude.ai/code/session_01WveaB7yyFo2T6yo7cnEpW9
binaryfire added a commit to hypervel/components-backup that referenced this pull request Oct 1, 2026
Following laravel/framework#59149, the mail,
markdown mail, view mail, form request and validation rule stubs import
the classes their PHPDoc references (Attachment, ValidationRule and
PotentiallyTranslatedString). The event, job middleware and middleware
stubs already did.

The factory stub differs from Laravel's: it keeps the model's
fully-qualified name in the PHPDoc instead of importing the model.
Importing it makes the generated file fatal when the model is named
Factory, or shares the generated factory's name. Laravel master has this
bug. A comment in FactoryMakeCommand records why, and a regression test
generates PlantFactory for a Factory model and lints the result.

Validation: the generator suite passes.

Claude-Session: https://claude.ai/code/session_01WveaB7yyFo2T6yo7cnEpW9
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