The ::addModules()/::addModuleStyles()/::addJsConfigVars() methods all take a string|array type. It would be better to simplify this.
One option would be string ...$modules and pass arrays with ...$array where needed. But the method names are already plural and strings are already cast to (array) already. So it's preferable to make the argument type string[] and have the callers explicitly create the array where necessary.
The addJsConfigVars method should probably always take a key->value associative array, and just change the callers in those (rare?) cases where a single key and value is passed.
It may be desirable to ensure that a given key is only written once by addJsConfigVars; see discussion in comments below.
We also need to better document these methods for ContentMetadataCollector; the current documentation has a @see OutputPage which of course isn't present in Parsoid.
Some codesearches to find usage:
- https://codesearch.wmcloud.org/search/?q=%5C%24p%5Cw%2B%5Cs*-%3E%5Cs*getOutput%5Cs*%5C(%5Cs*%5C)%5Cs*-%3E%5Cs*addModule%5BsS%5D(tyles)%3F%5Cs*%5C(%5Cs*%5B%22%27%5D&i=nope&files=&excludeFiles=&repos=
- https://codesearch.wmcloud.org/search/?q=%5C%24p%5Cw%2B%5BoO%5Dutput%5Cs*-%3E%5Cs*addModule%5BsS%5D(tyles)%3F%5Cs*%5C(%5Cs*%5B%22%27%5D&i=nope&files=&excludeFiles=&repos=