From 52a21ace03540c85c293e09898a90e048e2234bd Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sat, 31 Aug 2019 21:59:45 +0100 Subject: [PATCH] Fix method/function names case mismatch in core files PHP doesn't care much but I think we humans do because we should call methods by the name we give them. Method fixed are; - isOk() -> isOK() - setOk() -> setOK() - teardown() -> tearDown() Change-Id: I6b3f0cf3902887058efa426968da380803869e0b --- includes/MovePage.php | 4 ++-- includes/Title.php | 2 +- includes/api/ApiMove.php | 2 +- includes/installer/CliInstaller.php | 2 +- includes/installer/Installer.php | 4 ++-- includes/jobqueue/Job.php | 2 +- includes/jobqueue/JobRunner.php | 2 +- includes/libs/http/MultiHttpClient.php | 2 +- includes/specials/SpecialMovepage.php | 2 +- tests/phpunit/includes/api/ApiBaseTest.php | 2 +- .../includes/auth/UserDataAuthenticationRequestTest.php | 2 +- tests/phpunit/includes/specials/pagers/BlockListPagerTest.php | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/includes/MovePage.php b/includes/MovePage.php index e6faacef47..5f2acebb8c 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -446,7 +446,7 @@ class MovePage { $status = Status::newFatal( 'movepage-max-pages', $wgMaximumMovedPages ); $perTitleStatus[$oldSubpage->getPrefixedText()] = $status; $topStatus->merge( $status ); - $topStatus->setOk( true ); + $topStatus->setOK( true ); break; } @@ -479,7 +479,7 @@ class MovePage { } $perTitleStatus[$oldSubpage->getPrefixedText()] = $status; $topStatus->merge( $status ); - $topStatus->setOk( true ); + $topStatus->setOK( true ); } $topStatus->value = $perTitleStatus; diff --git a/includes/Title.php b/includes/Title.php index 3bf87c28f9..1acc7afacc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3532,7 +3532,7 @@ class Title implements LinkTarget, IDBAccessObject { $method = $auth ? 'moveSubpagesIfAllowed' : 'moveSubpages'; $result = $mp->$method( $wgUser, $reason, $createRedirect, $changeTags ); - if ( !$result->isOk() ) { + if ( !$result->isOK() ) { return $result->getErrorsArray(); } diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index d8f48b85a1..4cbed21394 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -207,7 +207,7 @@ class ApiMove extends ApiBase { $mp = new MovePage( $fromTitle, $toTitle ); $result = $mp->moveSubpagesIfAllowed( $this->getUser(), $reason, !$noredirect, $changeTags ); - if ( !$result->isOk() ) { + if ( !$result->isOK() ) { // This means the whole thing failed return [ 'errors' => $this->getErrorFormatter()->arrayFromStatus( $result ) ]; } diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 99d594df97..424c9d7b78 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -190,7 +190,7 @@ class CliInstaller extends Installer { // PerformInstallation bails on a fatal, so make sure the last item // completed before giving 'next.' Likewise, only provide back on failure $lastStepStatus = end( $result ); - if ( $lastStepStatus->isOk() ) { + if ( $lastStepStatus->isOK() ) { return Status::newGood(); } else { return $lastStepStatus; diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index de154561c4..a3951a1fae 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1607,11 +1607,11 @@ abstract class Installer { // If we've hit some sort of fatal, we need to bail. // Callback already had a chance to do output above. - if ( !$status->isOk() ) { + if ( !$status->isOK() ) { break; } } - if ( $status->isOk() ) { + if ( $status->isOK() ) { $this->showMessage( 'config-install-db-success' ); diff --git a/includes/jobqueue/Job.php b/includes/jobqueue/Job.php index c87dedc722..29086e69a1 100644 --- a/includes/jobqueue/Job.php +++ b/includes/jobqueue/Job.php @@ -135,7 +135,7 @@ abstract class Job implements RunnableJob { // When constructing this class for submitting to the queue, // normalise the $title arg of old job classes as part of $params. $params['namespace'] = $title->getNamespace(); - $params['title'] = $title->getDBKey(); + $params['title'] = $title->getDBkey(); } $this->command = $command; diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index adb4221cc5..709a67b01f 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -309,7 +309,7 @@ class JobRunner implements LoggerAwareInterface { } // Always attempt to call teardown() even if Job throws exception. try { - $job->teardown( $status ); + $job->tearDown( $status ); } catch ( Exception $e ) { MWExceptionHandler::logException( $e ); } diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index ed81a792f0..5e233aeb12 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -499,7 +499,7 @@ class MultiHttpClient implements LoggerAwareInterface { 'error' => '', ]; - if ( !$sv->isOk() ) { + if ( !$sv->isOK() ) { $svErrors = $sv->getErrors(); if ( isset( $svErrors[0] ) ) { $req['response']['error'] = $svErrors[0]['message']; diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 85f65bbe5c..0cb3bbae8b 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -749,7 +749,7 @@ class MovePageForm extends UnlistedSpecialPage { $mp = new MovePage( $oldSubpage, $newSubpage ); # This was copy-pasted from Renameuser, bleh. - if ( $newSubpage->exists() && !$mp->isValidMove()->isOk() ) { + if ( $newSubpage->exists() && !$mp->isValidMove()->isOK() ) { $link = $linkRenderer->makeKnownLink( $newSubpage ); $extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped(); } else { diff --git a/tests/phpunit/includes/api/ApiBaseTest.php b/tests/phpunit/includes/api/ApiBaseTest.php index 6a44ff3594..3adf1b62bc 100644 --- a/tests/phpunit/includes/api/ApiBaseTest.php +++ b/tests/phpunit/includes/api/ApiBaseTest.php @@ -1443,7 +1443,7 @@ class ApiBaseTest extends ApiTestCase { } $status = StatusValue::newGood(); - $status->setOk( false ); + $status->setOK( false ); try { $mock->dieStatus( $status ); $this->fail( 'Expected exception not thrown' ); diff --git a/tests/phpunit/includes/auth/UserDataAuthenticationRequestTest.php b/tests/phpunit/includes/auth/UserDataAuthenticationRequestTest.php index fc1930aa56..8c9a88f778 100644 --- a/tests/phpunit/includes/auth/UserDataAuthenticationRequestTest.php +++ b/tests/phpunit/includes/auth/UserDataAuthenticationRequestTest.php @@ -32,7 +32,7 @@ class UserDataAuthenticationRequestTest extends AuthenticationRequestTestCase { $req->email = $email; $req->realname = $realname; $this->assertEquals( $expect, $req->populateUser( $user ) ); - if ( $expect->isOk() ) { + if ( $expect->isOK() ) { $this->assertSame( $email ?: 'default@example.com', $user->getEmail() ); $this->assertSame( $realname ?: 'Fake Name', $user->getRealName() ); } diff --git a/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php b/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php index c0eadac56e..37c29abbc7 100644 --- a/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php +++ b/tests/phpunit/includes/specials/pagers/BlockListPagerTest.php @@ -248,7 +248,7 @@ class BlockListPagerTest extends MediaWikiTestCase { $restriction = $restrictions[0]; $this->assertEquals( $page->getId(), $restriction->getValue() ); $this->assertEquals( $page->getId(), $restriction->getTitle()->getArticleID() ); - $this->assertEquals( $title->getDBKey(), $restriction->getTitle()->getDBKey() ); + $this->assertEquals( $title->getDBkey(), $restriction->getTitle()->getDBkey() ); $this->assertEquals( $title->getNamespace(), $restriction->getTitle()->getNamespace() ); // Delete the block and the restrictions. -- 2.20.1