AbuseFilterVariableHolder has knowledge about several AFComputedVariable objects, and that's fine because they represent single variables. However, we also have a dependency the other way around: AFComputedVariable requires an AbuseFilterVariableHolder to be passed in when lazy-loading a variable, because computing a variable usually requires having the values of some other variables.
There are various possible solutions to this (require only an array of variables to be passed in, as opposed to a whole AbuseFilterVariableHolder object; use closures to lazy-load variables, creating the closures in VariableGenerator and passing them around; moving the compute method to a separate service; other solutions that I already forgot). However, attention should be paid because this code is currently very fragile. Some things that make this harder:
- We have many different variables, each requiring its own set of other variables
- Variable A may require variable B, which in turn might require variable C and so on
- Whenever a variable is lazy-loaded, the AbuseFilterVariableHolder object it belongs to should be updated with the newly-computed value
I had already analyzed this problem some time ago, but couldn't come up with a perfect solution. r568530 is a related experiment. Either way, we CANNOT change the AFComputedVariable class before T213006 is done (and this will introduce other problems, because we'd also have to wait for at least one release before dropping BC code, see r482518 and relation chain).