Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stub files management #52328

Conversation

stanislav-ernst
Copy link

When executing the command php artisan stub:publish I noticed that not all stubs are published. After checking, I realised that many paths are missing in the file Foundation/Console/StubPublishCommand.php. I also refactored console commands to use a resolveStubPath method for determining stub file locations. This enhances code maintainability and allows for custom stub paths, if specified.

I originally encountered the problem in a Laravel 11 project. If this change was made correctly for Laravel 10, the changes from my branch fix/update-stub-files-management could be adopted for version 11.

Refactored console commands to use a `resolveStubPath` method for determining stub file locations. This enhances code maintainability and allows for custom stub paths, if specified.
Removed unnecessary line breaks in the return statement of getStub() method to simplify the code and enhance readability. This change does not affect the functionality but improves code clarity.
Reorder the list of stub file path entries in the array in alphabetical order for better clarity. This change aims to improve readability and maintain consistency within the file.
Included additional stubs such as channel.stub, interface.stub, model.morph-pivot.stub, rule.implicit.stub, and view.stub. This expands the range of template files available for publication via the stub publish command.
@taylorotwell
Copy link
Member

That is intentional. We only publish the commonly customized stubs.

@stanislav-ernst
Copy link
Author

stanislav-ernst commented Aug 1, 2024

@taylorotwell Right, I skimmed over the sentence "To accomplish this, you may use the stub:publish command to publish the most common stubs to your application so that you can customize them". But why is that, if I may ask? Why are only the most frequently used stubs published?

Thank you very much for your work!

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