ContainerBuilder: removeDefinition removes from classes too#71
ContainerBuilder: removeDefinition removes from classes too#71TomasVotruba wants to merge 3 commits intonette:masterfrom TomasVotruba:patch-1
Conversation
|
Nice addition. If you could also add tests, that would be awesome. |
|
I'm on it. |
|
It's ready now. |
|
nice 👍 |
src/DI/ContainerBuilder.php
Outdated
There was a problem hiding this comment.
What about $this->classes[$class][FALSE]?
|
All occurrences should be removed, not only in |
|
@dg What do you mean? |
|
for example |
|
@dg I still don't undestand the point. I'm not familiar with $classes content in such depth. Could you provide failing usecase? |
|
class A extends stdClass {} $containerBuilder->addDefintion('two')->setClass('A'); |
|
This might do it. Please check. Edit: other test is failing. Will check tomorrow |
(cca, written on phone on a bike) |
There was a problem hiding this comment.
Hmmm, and what about this? $this->classes[$class][$mode] = array_diff($this->classes[$class][$mode], [$name]).
There was a problem hiding this comment.
I think it's less readable. It might be faster, container compilation is cached though.
There was a problem hiding this comment.
Dev code, I shall removed it.
|
Parfe! |
|
Thanx |
|
One more related bug: $someInterface => [
0 => FirstService
1 => SecondService
];Remove 'FirstService': $someInterface => [
1 => SecondService
];Then, Solution? Something like: return reset($this->classes[$class][TRUE]);What do you think? |
Use case: