Skip to content

[9.x] Add missing giveConfig method in ContextualBindingBuilder #38925

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

Conversation

denniscoorn-paqt
Copy link

This PR adds the method giveConfig to the ContextualBindingBuilder contract. A similar PR, #36361, was targeted at 8.x and rejected because it would introduce a breaking change for any implementation implementing this contract. That's why this PR is targeted at master to make it available for the upcoming 9.x release.

One of the reasons why I think this method should be part of the contract is that the ContextualBindingBuilder contract interface is declared as return type by the method Container::when(). When someone uses the "Binding primitives" example from the docs, where the existence of the giveConfig method is documented, they may encounter warnings from their IDE claiming that the method doesn't exists.

In my opinion this is small fix that can prevent possible confusion and improves developer experience.

@denniscoorn-paqt denniscoorn-paqt changed the title Add missing giveConfig method in ContextualBindingBuilder [9.x] Add missing giveConfig method in ContextualBindingBuilder Sep 23, 2021
@denniscoorn-paqt denniscoorn-paqt force-pushed the give-config-method-contextual-binding-builder branch from a1ccbbd to 42d0972 Compare September 23, 2021 13:26
@X-Coder264
Copy link
Contributor

X-Coder264 commented Sep 23, 2021

As @driesvints said in #36361 (comment) , and I agree:

giveConfig is syntactical sugar and not necessary for this contract.

The documentation could be updated instead to show how to bind primitives without using the giveConfig syntactical sugar.

@taylorotwell
Copy link
Member

See above.

@denniscoorn-paqt
Copy link
Author

Yeah, I saw the comment about it being classified as syntactical sugar, but I thought it was worth the shot because of the discrepancy between implementation and contract in relation to how it is being described in the documentation. Fair enough though ✌️

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.

3 participants