resourceloader: Change Context::getHash to always pass strings to implode

implode is documented as taking a string[], not mixed with int or null.
Explicitly cast or remove those instead of the implicit handling by PHP.

Change-Id: I0fac52c861bf85e09571b61a899b7a041aa77914
This commit is contained in:
Umherirrender 2021-11-02 15:24:55 +01:00 committed by Krinkle
parent 7c0ffb3b24
commit 808191ebc4

View file

@ -384,20 +384,20 @@ class ResourceLoaderContext implements MessageLocalizer {
* @return string
*/
public function getHash(): string {
if ( !isset( $this->hash ) ) {
if ( $this->hash === null ) {
$this->hash = implode( '|', [
// Module content vary
$this->getLanguage(),
$this->getSkin(),
$this->getDebug(),
$this->getUser(),
(string)$this->getDebug(),
$this->getUser() ?? '',
// Request vary
$this->getOnly(),
$this->getVersion(),
$this->getRaw(),
$this->getImage(),
$this->getVariant(),
$this->getFormat(),
$this->getOnly() ?? '',
$this->getVersion() ?? '',
(string)$this->getRaw(),
$this->getImage() ?? '',
$this->getVariant() ?? '',
$this->getFormat() ?? '',
] );
}
return $this->hash;