Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[DI] fix reporting bindings on overriden services as unused #29597
referenced this pull request
Dec 13, 2018
I'm afraid this won't work in most cases: we deep copy bindings in the loaders (see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L523). So instead we need to store bindings id and check against this list in the pass.
Dec 24, 2018
added a commit
this pull request
Dec 24, 2018
If I am not mistaken, this fix has created a new problem in ResolveBindingsPass.
The newly added puts all bindings that are set within a file into the usedBindings array. Before that, usedBindings array was empty as set in the property's declaration.
This means that aftewards, when processValue is called, the unusedBindings array remains empty, because the following condition is not met.
As a result, InvalidArgumentException (informing about an unused binding) is not thrown, even if a binding is actually not used. I have come upon this, because I was just about to make a PR solving #27828, but after I fetched the symfony code to make sure it is up to date my fix stopped working. I believe I can find a new solution, solving both problems.