Skip to content

Laravel Linter#2869

Draft
samuelwei wants to merge 1 commit intodevelopfrom
shift-167669
Draft

Laravel Linter#2869
samuelwei wants to merge 1 commit intodevelopfrom
shift-167669

Conversation

@samuelwei
Copy link
Collaborator

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

Before merging, you need to:

  • Checkout the shift-167669 branch
  • Review all pull request comments for additional changes
  • Thoroughly test your application (no tests?, no CI?)

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

@samuelwei
Copy link
Collaborator Author

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

@samuelwei
Copy link
Collaborator Author

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

  • config/auth.php
  • config/broadcasting.php
  • config/cache.php
  • config/database.php
  • config/filesystems.php
  • config/hashing.php
  • config/logging.php
  • config/mail.php
  • config/queue.php
  • config/services.php
  • config/session.php

@samuelwei
Copy link
Collaborator Author

ℹ️ Starting with Laravel 8, the model property within factories may be removed when your models are stored within a conventional location such as app/Models. Unless your factory is for a model outside of this location, you may remove this property.

@samuelwei
Copy link
Collaborator Author

⚠️ The following files reference Laravel facades through the global namespace. For example, you're referencing \DB or importing use DB. Instead import Illuminate\Support\Facades\DB and reference DB.

While global references are allowed through aliases, you should import the facade explicitly. This can improve clarity not only for developers, but static analysis used by your IDE.

  • app/Providers/RouteServiceProvider.php
  • tests/Backend/Feature/RouteMetricsTest.php

@samuelwei
Copy link
Collaborator Author

⚠️ 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.

  • app/Http/Controllers/MeetingController.php
  • app/Http/Controllers/RecordingController.php
  • app/Http/Controllers/RoomFileController.php
  • app/Http/Controllers/api/v1/ApplicationController.php
  • app/Http/Controllers/api/v1/MeetingController.php
  • app/Http/Controllers/api/v1/RoomController.php
  • app/Http/Controllers/api/v1/RoomMemberController.php
  • app/Http/Controllers/api/v1/RoomStreamingController.php
  • app/Http/Controllers/api/v1/RoomTypeStreamingController.php
  • app/Http/Controllers/api/v1/ServerController.php
  • app/Http/Controllers/api/v1/SettingsController.php
  • app/Http/Controllers/api/v1/StreamingController.php
  • app/Http/Controllers/api/v1/UserController.php
  • app/Http/Controllers/api/v1/auth/ForgotPasswordController.php
  • app/Http/Controllers/api/v1/auth/LoginController.php
  • app/Http/Controllers/api/v1/auth/ResetPasswordController.php
  • app/Http/Controllers/api/v1/auth/VerificationController.php

@samuelwei
Copy link
Collaborator Author

⚠️ 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/api/v1/UserController.php
  • app/Http/Controllers/api/v1/auth/RegisterController.php
  • app/Http/Controllers/api/v1/auth/ResetPasswordController.php

@samuelwei
Copy link
Collaborator Author

⚠️ 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/Middleware/TrustProxies.php

@samuelwei
Copy link
Collaborator Author

⚠️ 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.

  • app/Http/Controllers/MeetingController.php
  • app/Http/Controllers/api/v1/ApplicationController.php
  • app/Http/Controllers/api/v1/LocaleController.php
  • app/Http/Controllers/api/v1/RecordingController.php
  • app/Http/Controllers/api/v1/RoleController.php
  • app/Http/Controllers/api/v1/RoomController.php
  • app/Http/Controllers/api/v1/RoomMemberController.php
  • app/Http/Controllers/api/v1/RoomTypeController.php
  • app/Http/Controllers/api/v1/SessionController.php
  • app/Http/Controllers/api/v1/UserController.php
  • app/Http/Controllers/api/v1/auth/LoginController.php
  • app/Http/Controllers/api/v1/auth/VerificationController.php
  • app/Http/Middleware/LogContext.php
  • app/Http/Middleware/RoomAuthenticate.php
  • app/Http/Middleware/SetApplicationLocale.php

@samuelwei
Copy link
Collaborator Author

⚠️ Laravel contains many built-in helpers functions which allow you to write more expressive code or leverage core functionality from anywhere in your app.

Shift found the following code which could use a helper instead:

  • Config::get()

@samuelwei
Copy link
Collaborator Author

⚠️ 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:

  • routes/api.php
  • routes/web.php

@samuelwei
Copy link
Collaborator Author

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

@samuelwei
Copy link
Collaborator Author

ℹ️ 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.

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.71%. Comparing base (e7b9f30) to head (92ac057).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2869      +/-   ##
=============================================
+ Coverage      96.22%   96.71%   +0.48%     
  Complexity      1841     1841              
=============================================
  Files            265      444     +179     
  Lines           6285    12585    +6300     
  Branches           0     2066    +2066     
=============================================
+ Hits            6048    12171    +6123     
- Misses           237      414     +177     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cypress
Copy link

cypress bot commented Feb 23, 2026

PILOS    Run #2844

Run Properties:  status check passed Passed #2844  •  git commit 92ac057b2c: Laravel Linter
Project PILOS
Branch Review shift-167669
Run status status check passed Passed #2844
Run duration 07m 03s
Commit git commit 92ac057b2c: Laravel Linter
Committer Samuel Weirich
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 618
View all changes introduced in this branch ↗︎

@samuelwei samuelwei marked this pull request as draft March 4, 2026 10:45
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