aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUmherirrender <umherirrender_de.wp@web.de>2020-10-28 22:21:24 +0100
committerUmherirrender <umherirrender_de.wp@web.de>2020-10-28 22:21:24 +0100
commit448d2f4d5162650c1277c921d92e1ea353d7529c (patch)
treed3ea3fb84473e21dc7538d9ce76cd3f2477abf78
parentd621adbcb6c4f9b06122663aef43b8902ac3d8c3 (diff)
downloadmediawikicore-448d2f4d5162650c1277c921d92e1ea353d7529c.tar.gz
mediawikicore-448d2f4d5162650c1277c921d92e1ea353d7529c.zip
Avoid local variable with wg prefix
Change-Id: Ib32cc0db07636238aa0b4f8ea7f8c1ae37084889
-rw-r--r--.phpcs.xml6
-rw-r--r--includes/installer/Installer.php2
-rw-r--r--tests/common/TestSetup.php2
-rw-r--r--tests/phpunit/includes/api/ApiParseTest.php12
-rw-r--r--tests/phpunit/includes/exception/MWExceptionTest.php10
5 files changed, 12 insertions, 20 deletions
diff --git a/.phpcs.xml b/.phpcs.xml
index 6263ecf85357..71b251df5085 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -29,12 +29,6 @@
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
<exclude name="MediaWiki.Usage.PHPUnitAssertEquals.False" /><!-- autofix -->
<exclude name="MediaWiki.Usage.PHPUnitAssertEquals.True" /><!-- autofix -->
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgCommandLineMode" />
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgFullyInitialised" />
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgHooks" />
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgOut" />
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgPoolCounterConf" />
- <exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgSessionCacheType" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
</rule>
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 9798a3b66731..506d43c2c84f 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -1555,8 +1555,10 @@ abstract class Installer {
$data = $registry->readFromQueue( $queue );
$wgAutoloadClasses += $data['globals']['wgAutoloadClasses'];
+ // @phpcs:disable MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgHooks
// @phan-suppress-next-line PhanUndeclaredVariable,PhanCoalescingAlwaysNull $wgHooks is set by DefaultSettings
$hooksWeWant = $wgHooks['LoadExtensionSchemaUpdates'] ?? [];
+ // @phpcs:enable MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgHooks
if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
$hooksWeWant = array_merge_recursive(
diff --git a/tests/common/TestSetup.php b/tests/common/TestSetup.php
index 95c83cbac731..b47d8bb4714c 100644
--- a/tests/common/TestSetup.php
+++ b/tests/common/TestSetup.php
@@ -26,7 +26,7 @@ class TestSetup {
* of a Maintenance subclass
*/
public static function applyInitialConfig() {
- global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache;
+ global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache, $wgSessionCacheType;
global $wgMainStash;
global $wgObjectCaches;
global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
diff --git a/tests/phpunit/includes/api/ApiParseTest.php b/tests/phpunit/includes/api/ApiParseTest.php
index db6f5530f0cb..70bf22543454 100644
--- a/tests/phpunit/includes/api/ApiParseTest.php
+++ b/tests/phpunit/includes/api/ApiParseTest.php
@@ -884,13 +884,11 @@ class ApiParseTest extends ApiTestCase {
}
public function testConcurrentLimitPageParse() {
- $wgPoolCounterConf = [
+ $this->setMwGlobals( 'wgPoolCounterConf', [
'ApiParser' => [
'class' => MockPoolCounterFailing::class,
]
- ];
-
- $this->setMwGlobals( 'wgPoolCounterConf', $wgPoolCounterConf );
+ ] );
try{
$this->doApiRequest( [
@@ -904,13 +902,11 @@ class ApiParseTest extends ApiTestCase {
}
public function testConcurrentLimitContentParse() {
- $wgPoolCounterConf = [
+ $this->setMwGlobals( 'wgPoolCounterConf', [
'ApiParser' => [
'class' => MockPoolCounterFailing::class,
]
- ];
-
- $this->setMwGlobals( 'wgPoolCounterConf', $wgPoolCounterConf );
+ ] );
try{
$this->doApiRequest( [
diff --git a/tests/phpunit/includes/exception/MWExceptionTest.php b/tests/phpunit/includes/exception/MWExceptionTest.php
index f8025f209f11..09570967b3b8 100644
--- a/tests/phpunit/includes/exception/MWExceptionTest.php
+++ b/tests/phpunit/includes/exception/MWExceptionTest.php
@@ -20,11 +20,11 @@ class MWExceptionTest extends MediaWikiIntegrationTestCase {
* @dataProvider provideTextUseOutputPage
* @covers MWException::useOutputPage
*/
- public function testUseOutputPage( $expected, $langObj, $wgFullyInitialised, $wgOut ) {
+ public function testUseOutputPage( $expected, $langObj, $fullyInitialised, $outputPage ) {
$this->setMwGlobals( [
'wgLang' => $langObj,
- 'wgFullyInitialised' => $wgFullyInitialised,
- 'wgOut' => $wgOut,
+ 'wgFullyInitialised' => $fullyInitialised,
+ 'wgOut' => $outputPage,
] );
$e = new MWException();
@@ -69,9 +69,9 @@ class MWExceptionTest extends MediaWikiIntegrationTestCase {
* @dataProvider provideIsCommandLine
* @covers MWException::isCommandLine
*/
- public function testisCommandLine( $expected, $wgCommandLineMode ) {
+ public function testisCommandLine( $expected, $commandLineMode ) {
$this->setMwGlobals( [
- 'wgCommandLineMode' => $wgCommandLineMode,
+ 'wgCommandLineMode' => $commandLineMode,
] );
$e = new MWException();
$this->assertEquals( $expected, $e->isCommandLine() );