christiancable / nexus5ive

This is the code that powers the _old-school style_ BBS at http://nexus5.org.uk
2 stars 1 forks source link

Laravel Linter #481

Open christiancable opened 2 months ago

christiancable commented 2 months 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-127871 branch.

Before merging, you need to:

Much of the lint detected may be automatically fixed by running the Laravel Fixer or tasks within the Shift Workbench.

christiancable commented 2 months ago

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

christiancable commented 2 months ago

:x: The following configuration files differ from the Laravel defaults. If you are modifying configuration values directly, consider using an environment variable instead to keep these files maintainable. You should compare your configuration files against the latest version and merge any updates.

christiancable commented 2 months 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.

christiancable commented 2 months ago

:warning: The following controllers contain actions outside of the 7 resource actions (index, create, store, show, edit, update, destroy). For more details, review the docs or watch Cruddy by Design to see if you may rework these into resource controllers.

christiancable commented 2 months 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.

christiancable commented 2 months ago

:warning: Shift detected the following HTTP components using the Request or Input facade to access the request. Within these components you should leverage the request object which is automatically injected to any controller action or Middleware.

christiancable commented 2 months ago

:warning: Shift detected the following HTTP components accessing the authenticated user through Auth::user(). Within these components, you may access the authenticated user through the request object as well. Doing so limits your dependencies by leveraging objects already available.

christiancable commented 2 months ago

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

christiancable commented 2 months ago

:warning: Shift detected api routes within routes/web.php. Routes within this file should be dedicated to your web interface. The routes in routes/api.php are stateless and use the api middleware group. When possible, consider reorganizing your routes to follow this design separation.

christiancable commented 2 months ago

:warning: Laravel 10.0 no longer includes the resources/lang folder by default. Instead, you may publish if you need to make customizations. Shift detected your language files match the defaults and as such your resources/lang folder may be removed.

christiancable commented 2 months ago

:x: Laravel 9.0 moved the resources/lang folder to a top-level lang folder. While Laravel allows the old folder, future versions may not. You should migrate this folder and add any new files.

christiancable commented 2 months ago

:information_source: Laravel 8 reintroduced the app/Models folder by default. This is an optional change. Laravel and the artisan commands will automatically detect if you are using the app/Models folder or not.

If you wish to modernize your application to use the app/Models folder, you may run the Namespace Models Shift for free.

christiancable commented 2 months ago

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

christiancable commented 2 months ago

:x: Laravel 10 added PHP type hints to all user-land code included in a new Laravel application. Shift detected these files are missing type hints. Shift recommends adding them to align with the latest Laravel conventions. You may automate this process by running the Laravel Type Hints task within Shift Workbench.

christiancable commented 2 months 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.