Skip to content
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

[DI] Fix bad error message for unused bind under _defaults #29935

Merged
merged 1 commit into from Apr 7, 2019

Conversation

@przemyslaw-bogusz
Copy link
Contributor

commented Jan 19, 2019

Q A
Branch? master
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27828
License MIT

Sidenote: I originally included the fix in #29897, but I decided to close the previous PR and divide it into two separate PRs for clarity.

Description:
With this fix, the message regarding an unused bind will have a clear information about the type of the bind (defined under _defaults, _instanceof or per service), as well as the name of the file, in which it was configurated. It's for, both, YAML and XML configurations.

For the core team, please note, that the fix assumes a possibility of definings binds under _instanceof, which was introduced in #27806. But since fixes are merged into other branches, I thought that it might be necessary to inlude this possibility. If this case requires making separate fixes for different branches, I will gladly do it.

@przemyslaw-bogusz przemyslaw-bogusz force-pushed the przemyslaw-bogusz:ticket_27828 branch 3 times, most recently from 328bbfb to ffbdd40 Jan 20, 2019

@nicolas-grekas nicolas-grekas changed the title [DI] Fixes: #27828 - Bad error message for unused bind under _defaults [DI] Fix bad error message for unused bind under _defaults Jan 24, 2019

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Jan 24, 2019

@nicolas-grekas
Copy link
Member

left a comment

Looks nice!
That should target master to me, it's more an improvement than a bug fix.
Tests fail because composer.json files need to bump the minimum supported version of di, for http-kernel.

@sstok

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2019

Can this also be added for the PHP DSL loader? Really nice addition!

@przemyslaw-bogusz przemyslaw-bogusz force-pushed the przemyslaw-bogusz:ticket_27828 branch from ffbdd40 to d2d59af Jan 26, 2019

@przemyslaw-bogusz przemyslaw-bogusz changed the base branch from 3.4 to master Jan 26, 2019

@przemyslaw-bogusz

This comment has been minimized.

Copy link
Contributor Author

commented Jan 26, 2019

Thanks for the positive feedback!

@sstok
I added the same functionality to PHP DSL loader.

@nicolas-grekas

  1. Changed target to master.
  2. Modified the error message so that it refers to argument's name, type or both - depending on the configuration.
@przemyslaw-bogusz

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

@nicolas-grekas

Tests fail because composer.json files need to bump the minimum supported version of di, for http-kernel.

Does it mean I have to make changes in composer.json in my repository? It seems to be identical with the one from Symfony's repository?

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 4, 2019

@nicolas-grekas friendly ping

@weaverryan weaverryan modified the milestones: 3.4, next Apr 3, 2019

@nicolas-grekas
Copy link
Member

left a comment

Looks nice, sorry for the late review, here are some comments.

@weaverryan

This comment has been minimized.

Copy link
Member

commented Apr 5, 2019

Ping @przemyslaw-bogusz! Will you have time to check out the tweaks? We can hopefully get this into 4.3! :)

@przemyslaw-bogusz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2019

I will do it tomorrow, so I believe we can close it by the end of the weekend. Hope that's good enough.

@weaverryan

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

It's great :). Thank you for your work!

@Simperfit

This comment has been minimized.

Copy link
Contributor

commented Apr 6, 2019

@przemyslaw-bogusz do you have time to finish this or do you want me to take the rest of it ?

@przemyslaw-bogusz przemyslaw-bogusz force-pushed the przemyslaw-bogusz:ticket_27828 branch 2 times, most recently from 627c437 to 531be07 Apr 6, 2019

@przemyslaw-bogusz przemyslaw-bogusz force-pushed the przemyslaw-bogusz:ticket_27828 branch from 531be07 to c960bdb Apr 6, 2019

@przemyslaw-bogusz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 6, 2019

@nicolas-grekas, @weaverryan Thank you for your patience. If you have any additional comments, please let me know. I hope we will also be able to close #29944.

@nicolas-grekas nicolas-grekas force-pushed the przemyslaw-bogusz:ticket_27828 branch from c960bdb to 35bf420 Apr 7, 2019

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Apr 7, 2019

Thank you @przemyslaw-bogusz.

@nicolas-grekas nicolas-grekas merged commit 35bf420 into symfony:master Apr 7, 2019

1 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
fabbot.io Your code looks good.
Details

nicolas-grekas added a commit that referenced this pull request Apr 7, 2019

feature #29935 [DI] Fix bad error message for unused bind under _defa…
…ults (przemyslaw-bogusz)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Fix bad error message for unused bind under _defaults

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27828
| License       | MIT

**Sidenote**: I originally included the fix in #29897, but I decided to close the previous PR and divide it into two separate PRs for clarity.

**Description:**
With this fix, the message regarding an unused bind will have a clear information about the type of the bind (defined under __defaults_, __instanceof_ or _per service_), as well as the name of the file, in which it was configurated. It's for, both, YAML and XML configurations.

For the core team, please note, that the fix assumes a possibility of definings binds under __instanceof_, which was introduced in #27806. But since fixes are merged into other branches, I thought that it might be necessary to inlude this possibility. If this case requires making separate fixes for different branches, I will gladly do it.

Commits
-------

35bf420 [DI] Fix bad error message for unused bind under _defaults

@przemyslaw-bogusz przemyslaw-bogusz deleted the przemyslaw-bogusz:ticket_27828 branch Apr 8, 2019

@symfony symfony deleted a comment from nicolas-grekas Apr 8, 2019

@weaverryan

This comment has been minimized.

Copy link
Member

commented Apr 8, 2019

Congrats! Thank you SO much @przemyslaw-bogusz!!

@scott-r-lindsey

This comment has been minimized.

Copy link

commented Apr 9, 2019

Workaround until 4.2.6: make sure that at least one service consumes each dependency mentioned in _defaults / bind

@weaverryan

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

That will still be the case after this PR. This is just to correct the error message, which was misleading. I think #29944 might be what you’re looking for.

@przemyslaw-bogusz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 9, 2019

@scott-r-lindsey I am not sure, if I understand you correctly, but the whole purpose of ResolveBindingsPass is to inform you of any unused bindings - the ones that you define, but do not use/consume in any of your services. You simply cannot have a surplus of bindings.

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019

@fabpot fabpot referenced this pull request May 9, 2019

Merged

Release v4.3.0-BETA1 #31435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.