From 2d7d5e33832061c65a31b7ee97c38ee86c52857d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 22 Mar 2024 11:47:14 -0700 Subject: [PATCH] SpecialGlobalGroupMembership: Avoid deprecated Xml::checkLabel This method has a ton of layers of indirection, which makes for an unintuitive signature, as well as various compromises in its API design that are not something you can reasonably remember and learn. ``` Xml::checkLabel( $member, "wpGroup-" . $group, "wpGroup-" . $group, $set, $attr ); ``` You can stare at this for quite a while and still have no confidence in what it actually produces. You have to either run it in a REPL, or setup up an elaborate UX test to find the exact scenario in a local environment to inspect the DOM. The method docs don't mitigate this, either, but with such a bad signature, docs would indeed be at best help mitigate and manage expectations, instead of actually making it intuitiive, productive, or memorable. Xml::checkLabel() takes 4 unnamed parameters, of which two are often the same value passed twice (name and ID), one applies only to the label ($labelText) which is actually the first parameter despite being used for only the last element in the output. It produces the `` element first and the `