TechnicSolder icon indicating copy to clipboard operation
TechnicSolder copied to clipboard

Laravel Linter

Open Pyker opened this issue 4 years ago • 9 comments

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

Before merging, you need to:

  • Checkout the shift-27508 branch
  • Review all pull request comments for additional changes
  • Thoroughly test your application

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.

Pyker avatar May 05 '20 14:05 Pyker

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

Pyker avatar May 05 '20 14:05 Pyker

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

Pyker avatar May 05 '20 14:05 Pyker

: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'.

Pyker avatar May 05 '20 14:05 Pyker

: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 can rework these into resource controllers.

  • [ ] app/Http/Controllers/ApiController.php
  • [ ] app/Http/Controllers/AuthController.php
  • [ ] app/Http/Controllers/ClientController.php
  • [ ] app/Http/Controllers/DashboardController.php
  • [ ] app/Http/Controllers/KeyController.php
  • [ ] app/Http/Controllers/ModController.php
  • [ ] app/Http/Controllers/ModpackController.php
  • [ ] app/Http/Controllers/SolderController.php
  • [ ] app/Http/Controllers/UserController.php

Pyker avatar May 05 '20 14:05 Pyker

: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.

  • [ ] app/Http/Controllers/ClientController.php
  • [ ] app/Http/Controllers/KeyController.php
  • [ ] app/Http/Controllers/ModController.php
  • [ ] app/Http/Controllers/ModpackController.php
  • [ ] app/Http/Controllers/UserController.php

Pyker avatar May 05 '20 14:05 Pyker

: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.

  • [ ] app/Http/Controllers/ApiController.php
  • [ ] app/Http/Controllers/AuthController.php
  • [ ] app/Http/Controllers/ClientController.php
  • [ ] app/Http/Controllers/KeyController.php
  • [ ] app/Http/Controllers/ModController.php
  • [ ] app/Http/Controllers/ModpackController.php
  • [ ] app/Http/Controllers/SolderController.php
  • [ ] app/Http/Controllers/UserController.php

Pyker avatar May 05 '20 14:05 Pyker

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

  • [ ] app/Http/Controllers/AuthController.php
  • [ ] app/Http/Controllers/ModpackController.php
  • [ ] app/Http/Controllers/UserController.php

Pyker avatar May 05 '20 14:05 Pyker

: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.

  • [x] config/app.php

Pyker avatar May 05 '20 14:05 Pyker

: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.

Pyker avatar May 05 '20 14:05 Pyker