On 05/14/2013 07:54 AM, Jeroen De Dauw wrote:
One of the few places where static does not hurt is in leaf methods. For instance Math::abs. It is still somewhat dangerous to create such methods, since it is quite possible a leaf stops being a leaf. And Html::element certainly is not a leaf method. It is invoking other methods that on their turn invoke more methods, some of which with quite high complexity. And some of which are using global variables or static fields in the Html class. Using this nearly everywhere means that nearly everything is quite dependent on this specific code and its state.
What state? The only class state I see is configuration information (namely $voidElements, $boolAttribs, and $HTMLFiveOnlyAttribs, none of which are written too).
Those are the only static fields I'm aware of.
And I believe the only globals are simple configuration variables (e.g. wgWellFormedXml) from LocalSettings (nothing like $wgUser).
Matt Flaschen