For fixing code styling mistakes, there's a great tool called Laravel Pint. In this article, I will list one of the most typical fixes it makes, with before/after examples.
1. Unused Imports
Unused imports are one of the most common code style issues in code. This can be caused by copying and pasting some code or simply by refactoring some classes. It usually looks like this:
While my editor marked them as unused - that might not be the case for your editor. That's why Pint has a rule about it:
https://github.com/laravel/pint/blob/main/resources/presets/laravel.php
'no_unused_imports' => true,
And once you run /vendor/bin/pint fix
it will remove all unused imports:
2. Function Visibility
Functions in PHP should have their visibility defined even if it's public
by default. This is a...