Skip to content

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
Collaborator

Seems like a sensible change to me. 👍

@GrahamCampbell
Copy link
Collaborator

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