Skip to content

[13.x] Fix the ModelMakeCommand handle return type - #60989

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
dfinchenko:fix-modelmakecommand-handle-return-type
Aug 2, 2026
Merged

[13.x] Fix the ModelMakeCommand handle return type#60989
taylorotwell merged 1 commit into
laravel:13.xfrom
dfinchenko:fix-modelmakecommand-handle-return-type

Conversation

@dfinchenko

Copy link
Copy Markdown
Contributor

ModelMakeCommand::handle() is annotated @return void, but it returns false when the model already exists and the user declines to generate the additional components.

GeneratorCommand::handle(), which it overrides, is annotated @return bool|null, and ProviderMakeCommand already carries that same annotation on its own override.

PHPStan reports three errors on the file as it stands:

Return type (void) of method ModelMakeCommand::handle() should be compatible with
return type (bool|null) of method GeneratorCommand::handle()

Method ModelMakeCommand::handle() with return type void returns false but should not return anything.
Method ModelMakeCommand::handle() with return type void returns false but should not return anything.

Syncing the annotation with the parent's resolves all three, and makes the command analysable when it is extended in an application. Docblock only, no behavior change.

@taylorotwell
taylorotwell merged commit c9f5770 into laravel:13.x Aug 2, 2026
40 of 55 checks passed
@dfinchenko
dfinchenko deleted the fix-modelmakecommand-handle-return-type branch August 2, 2026 21:23
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