diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b330d34..7c3f895 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -19,3 +19,13 @@ parameters: message: "#^Cannot cast mixed to string\\.$#" count: 1 path: src/WikibaseExportExtension.php + + - + message: "#^If condition is always true\\.$#" + count: 1 + path: src/EntryPoints/SpecialWikibaseExport.php + + - + message: "#^If condition is always true\\.$#" + count: 1 + path: src/EntryPoints/SpecialWikibaseExportConfig.php diff --git a/src/EntryPoints/SpecialWikibaseExport.php b/src/EntryPoints/SpecialWikibaseExport.php index 37eca58..00635a1 100644 --- a/src/EntryPoints/SpecialWikibaseExport.php +++ b/src/EntryPoints/SpecialWikibaseExport.php @@ -38,8 +38,15 @@ public function getGroupName(): string { return 'wikibase'; } - public function getDescription(): Message { - return $this->msg( 'special-wikibase-export' ); + /** + * @return string|Message Returns string in MW < 1.41 and Message in MW >= 1.41 + */ + public function getDescription() { + if ( version_compare( MW_VERSION, '1.41', '>=' ) ) { + return $this->msg( 'special-wikibase-export' ); + } else { + return $this->msg( 'special-wikibase-export' )->escaped(); + } } private function shouldShowConfigLink(): bool { diff --git a/src/EntryPoints/SpecialWikibaseExportConfig.php b/src/EntryPoints/SpecialWikibaseExportConfig.php index 9c2bc36..a73b776 100644 --- a/src/EntryPoints/SpecialWikibaseExportConfig.php +++ b/src/EntryPoints/SpecialWikibaseExportConfig.php @@ -4,6 +4,7 @@ namespace ProfessionalWiki\WikibaseExport\EntryPoints; +use Message; use SpecialPage; use Title; @@ -27,8 +28,15 @@ public function getGroupName(): string { return 'wikibase'; } - public function getDescription(): string { - return $this->msg( 'special-wikibase-export-config' )->escaped(); + /** + * @return string|Message Returns string in MW < 1.41 and Message in MW >= 1.41 + */ + public function getDescription() { + if ( version_compare( MW_VERSION, '1.41', '>=' ) ) { + return $this->msg( 'special-wikibase-export-config' ); + } else { + return $this->msg( 'special-wikibase-export-config' )->escaped(); + } } }