From: Erik Bernhardson Date: Tue, 13 Dec 2016 19:51:07 +0000 (-0800) Subject: Fix PhanTypeInvalidLeftOperand in Language.php X-Git-Tag: 1.31.0-rc.0~4568^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=f5f779560917ac72798c1fb1b386d35b0a837378;p=lhc%2Fweb%2Fwiklou.git Fix PhanTypeInvalidLeftOperand in Language.php Not entirely sure what's going on here. Best guess is phan isn't able to figure out that array + mixed will result in an array, and then adding validNamespaces (another array) is ok. Could make things a little more explicit with array_merge, but this seems to work to remove the issue without changing the meaning of the code. Change-Id: I7031ae4e68878ec3198e47c55ab5de4d52a6d922 --- diff --git a/languages/Language.php b/languages/Language.php index 3eb6546490..0e91e2e08b 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -45,7 +45,9 @@ class Language { public $dateFormatStrings = []; public $mExtendedSpecialPageAliases; - protected $namespaceNames, $mNamespaceIds, $namespaceAliases; + /** @var array|null */ + protected $namespaceNames; + protected $mNamespaceIds, $namespaceAliases; /** * ReplacementArray object caches @@ -463,11 +465,11 @@ class Language { if ( is_null( $this->namespaceNames ) ) { global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces; - $this->namespaceNames = self::$dataCache->getItem( $this->mCode, 'namespaceNames' ); $validNamespaces = MWNamespace::getCanonicalNamespaces(); - /** @suppress PhanTypeInvalidLeftOperand */ - $this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames + $validNamespaces; + $this->namespaceNames = $wgExtraNamespaces + + self::$dataCache->getItem( $this->mCode, 'namespaceNames' ); + $this->namespaceNames += $validNamespaces; $this->namespaceNames[NS_PROJECT] = $wgMetaNamespace; if ( $wgMetaNamespaceTalk ) {