Skip to content

Commit 1bfab97

Browse files
committed
Add fallback getDescription method for MW < 1.41 compat
Fixes: #191
1 parent 702d6e4 commit 1bfab97

3 files changed

Lines changed: 29 additions & 4 deletions

File tree

phpstan-baseline.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ parameters:
1919
message: "#^Cannot cast mixed to string\\.$#"
2020
count: 1
2121
path: src/WikibaseExportExtension.php
22+
23+
-
24+
message: "#^If condition is always true\\.$#"
25+
count: 1
26+
path: src/EntryPoints/SpecialWikibaseExport.php
27+
28+
-
29+
message: "#^If condition is always true\\.$#"
30+
count: 1
31+
path: src/EntryPoints/SpecialWikibaseExportConfig.php

src/EntryPoints/SpecialWikibaseExport.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,15 @@ public function getGroupName(): string {
3838
return 'wikibase';
3939
}
4040

41-
public function getDescription(): Message {
42-
return $this->msg( 'special-wikibase-export' );
41+
/**
42+
* @return string|Message Returns string in MW < 1.41 and Message in MW >= 1.41
43+
*/
44+
public function getDescription() {
45+
if ( version_compare( MW_VERSION, '1.41', '>=' ) ) {
46+
return $this->msg( 'special-wikibase-export' );
47+
} else {
48+
return $this->msg( 'special-wikibase-export' )->escaped();
49+
}
4350
}
4451

4552
private function shouldShowConfigLink(): bool {

src/EntryPoints/SpecialWikibaseExportConfig.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ProfessionalWiki\WikibaseExport\EntryPoints;
66

7+
use Message;
78
use SpecialPage;
89
use Title;
910

@@ -27,8 +28,15 @@ public function getGroupName(): string {
2728
return 'wikibase';
2829
}
2930

30-
public function getDescription(): string {
31-
return $this->msg( 'special-wikibase-export-config' )->escaped();
31+
/**
32+
* @return string|Message Returns string in MW < 1.41 and Message in MW >= 1.41
33+
*/
34+
public function getDescription() {
35+
if ( version_compare( MW_VERSION, '1.41', '>=' ) ) {
36+
return $this->msg( 'special-wikibase-export-config' );
37+
} else {
38+
return $this->msg( 'special-wikibase-export-config' )->escaped();
39+
}
3240
}
3341

3442
}

0 commit comments

Comments
 (0)