Skip to content

[8.x] Remove TrustHosts reliance on config helper #39293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

[8.x] Remove TrustHosts reliance on config helper #39293

wants to merge 1 commit into from

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Oct 21, 2021

This PR removes the TrustHosts middleware's reliance on the config() helper, this achieves two things:

  • Developers can now unit test their application's implementation more easily, because they can simply mock the application instance this middleware receives through it's constructor
  • If a developer were to extend Illuminate\Contracts\Foundation\Application::environment() for some reason, the middleware would now take that into account

This change should be BC, except when \Illuminate\Contracts\Foundation\Application::environment has been extended. In which case the current check already didn't work and likely was overwritten at an application level anyway.

@GrahamCampbell
Copy link
Member

Seems like a sensible change to me. 👍

@GrahamCampbell
Copy link
Member

Maybe for 9.x though. People manually changing the config value in their tests will have stuff broken.

@axlon
Copy link
Contributor Author

axlon commented Oct 21, 2021

@GrahamCampbell I'll remake the PR to master 👍

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