mmockelyn / transportfeverfrance

Site de Transport Fever France
0 stars 0 forks source link

Laravel Linter #124

Closed mmockelyn closed 3 years ago

mmockelyn commented 3 years ago

This pull request includes changes and recommendations for crafting your application "The Laravel Way". Feel free to commit any additional changes to the shift-48972 branch.

Before merging, you need to:

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

mmockelyn commented 3 years ago

:warning: Shift found uses of the old array() syntax. Laravel adopted the short array syntax [] since it became available in PHP 5.4.

mmockelyn commented 3 years ago

:warning: Shift found instances of string based class references. Laravel adopted the ::class static property since it became available in PHP 5.5. You should update your code to use references like App\SomeModel::class instead of strings like 'App\SomeModel'.

mmockelyn commented 3 years ago

:warning: Shift detected Eloquent calls in the following views. You should keep views from interacting directly with your models by passing the necessary data from the controller.

mmockelyn commented 3 years ago

:warning: The following classes do not contain any public methods. These may be better served as a helper or service rather than a controller:

mmockelyn commented 3 years ago

:warning: Shift found inline validation in the following controllers. Unless you require this level of control, you should use a Form Request to encapsulate this validation logic and keep your controller clean. You may automate this conversion with the Laravel Fixer.

mmockelyn commented 3 years ago

:warning: Shift found opportunities to use the built-in Blade directives like @auth, @csrf, @method, @method in the following views:

mmockelyn commented 3 years ago

:warning: To improve performance by caching your configuration, Laravel recommends you only use the env() helper within configuration files and use config() everywhere else. Shift found potential uses of env() in:

mmockelyn commented 3 years ago

:information_source: Shift detected controller namespaces being set in your RouteServiceProvider. Laravel 8 began registering controllers using static class references instead of namespace prefixes and controller names.

You may automate this conversion using the Laravel Fixer or tasks within the Shift Workbench.

mmockelyn commented 3 years ago

:warning: Shift found the following config files differ from the defaults. While you are welcome to customize your configuration, you should leverage ENV variables rather than hardcode values. If you find you're adding a lot of configuration options, consider creating a domain specific config file, such as core.php. Both will make app upgrades and deployments easier.

mmockelyn commented 3 years ago

:warning: Laravel uses PSR-4 autoloading for the app/ folder. While you can configure your application to load these files within composer.json, all files under the app folder should be classes with a PSR-4 compliant namespace.

The following PHP files are missing a namespace:

mmockelyn commented 3 years ago

:information_source: As noted, much of the lint detected above can be automatically fixed using the Laravel Fixer. Save yourself time and clean up your codebase quickly with this new Shift.