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 * @return string
*/ */
public function getHash(): string { public function getHash(): string {
if ( !isset( $this->hash ) ) { if ( $this->hash === null ) {
$this->hash = implode( '|', [ $this->hash = implode( '|', [
// Module content vary // Module content vary
$this->getLanguage(), $this->getLanguage(),
$this->getSkin(), $this->getSkin(),
$this->getDebug(), (string)$this->getDebug(),
$this->getUser(), $this->getUser() ?? '',
// Request vary // Request vary
$this->getOnly(), $this->getOnly() ?? '',
$this->getVersion(), $this->getVersion() ?? '',
$this->getRaw(), (string)$this->getRaw(),
$this->getImage(), $this->getImage() ?? '',
$this->getVariant(), $this->getVariant() ?? '',
$this->getFormat(), $this->getFormat() ?? '',
] ); ] );
} }
return $this->hash; return $this->hash;