From f402ecd31fd080481447a85d5a5f2ab2c0bf92cb Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Tue, 11 Jun 2019 22:43:05 +0100 Subject: [PATCH] Echo: Fix case mismatch for function/method calls PHP doesn't care much about the name (in terms of case sensitivity) but I think we should make sure the names of the method should be as they're in their definition. Change-Id: I6e38d8be64efaec4200471f2d3007275d7ddecec --- includes/EchoHooks.php | 10 +++++----- includes/EmailBatch.php | 2 +- includes/api/ApiEchoNotifications.php | 4 ++-- includes/api/ApiEchoUnreadNotificationPages.php | 2 +- includes/cache/TitleLocalCache.php | 2 +- includes/controller/NotificationController.php | 2 +- includes/formatters/PageLinkedPresentationModel.php | 4 ++-- includes/mapper/NotificationMapper.php | 4 ++-- includes/model/TargetPage.php | 2 +- includes/special/SpecialNotificationsMarkRead.php | 2 +- maintenance/generateSampleNotifications.php | 2 +- tests/phpunit/AttributeManagerTest.php | 6 +++--- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/includes/EchoHooks.php b/includes/EchoHooks.php index 86a5cb127..1f621aead 100644 --- a/includes/EchoHooks.php +++ b/includes/EchoHooks.php @@ -730,7 +730,7 @@ class EchoHooks { [ 'type' => 'user-rights', 'extra' => [ - 'user' => $user->getID(), + 'user' => $user->getId(), 'expiry-changed' => $expiryChanged, 'reason' => $reason, ], @@ -744,7 +744,7 @@ class EchoHooks { [ 'type' => 'user-rights', 'extra' => [ - 'user' => $user->getID(), + 'user' => $user->getId(), 'add' => $reallyAdded, 'remove' => $remove, 'reason' => $reason, @@ -804,7 +804,7 @@ class EchoHooks { continue; } - $linkFromPageId = $linksUpdate->mTitle->getArticleId(); + $linkFromPageId = $linksUpdate->mTitle->getArticleID(); EchoEvent::create( [ 'type' => 'page-linked', 'title' => $title, @@ -1016,7 +1016,7 @@ class EchoHooks { $alertLink = [ 'href' => $url, 'text' => $alertText, - 'active' => ( $url == $title->getLocalUrl() ), + 'active' => ( $url == $title->getLocalURL() ), 'class' => $alertLinkClasses, 'data' => [ 'counter-num' => $alertCount, @@ -1031,7 +1031,7 @@ class EchoHooks { $msgLink = [ 'href' => $url, 'text' => $msgText, - 'active' => ( $url == $title->getLocalUrl() ), + 'active' => ( $url == $title->getLocalURL() ), 'class' => $msgLinkClasses, 'data' => [ 'counter-num' => $msgCount, diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php index 9451264bc..866e47404 100644 --- a/includes/EmailBatch.php +++ b/includes/EmailBatch.php @@ -245,7 +245,7 @@ class MWEchoEmailBatch { $dbr = $dbFactory->getEchoDb( DB_REPLICA ); $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); - $domainId = $dbw->getDomainId(); + $domainId = $dbw->getDomainID(); $iterator = new BatchRowIterator( $dbr, 'echo_email_batch', 'eeb_event_id', $wgUpdateRowsPerQuery ); $iterator->addConditions( [ 'eeb_user_id' => $this->mUser->getId() ] ); diff --git a/includes/api/ApiEchoNotifications.php b/includes/api/ApiEchoNotifications.php index 3c84d2055..ee0ab5421 100644 --- a/includes/api/ApiEchoNotifications.php +++ b/includes/api/ApiEchoNotifications.php @@ -236,7 +236,7 @@ class ApiEchoNotifications extends ApiQueryBase { /** @var EchoNotification $first */ $first = reset( $notifs ); $continueId = intval( trim( strrchr( $continue, '|' ), '|' ) ); - if ( $first->getEvent()->getID() !== $continueId ) { + if ( $first->getEvent()->getId() !== $continueId ) { // notification doesn't match continue id, it must've been // about read notifications: discard all unread ones $notifs = []; @@ -388,7 +388,7 @@ class ApiEchoNotifications extends ApiQueryBase { return $timestampsByWiki[$b]->getTimestamp( TS_UNIX ) - $timestampsByWiki[$a]->getTimestamp( TS_UNIX ); } ); - $row = new StdClass; + $row = new stdClass; $row->event_id = -1; $row->event_type = 'foreign'; $row->event_variant = null; diff --git a/includes/api/ApiEchoUnreadNotificationPages.php b/includes/api/ApiEchoUnreadNotificationPages.php index 7ef2d6e5e..5b53c8b44 100644 --- a/includes/api/ApiEchoUnreadNotificationPages.php +++ b/includes/api/ApiEchoUnreadNotificationPages.php @@ -101,7 +101,7 @@ class ApiEchoUnreadNotificationPages extends ApiQueryBase { $pageName = $title->getPrefixedText(); } - $count = $pageCounts[$title->getArticleId()]; + $count = $pageCounts[$title->getArticleID()]; if ( isset( $groupCounts[$pageName] ) ) { $groupCounts[$pageName] += $count; } else { diff --git a/includes/cache/TitleLocalCache.php b/includes/cache/TitleLocalCache.php index d896b0121..b756b0f79 100644 --- a/includes/cache/TitleLocalCache.php +++ b/includes/cache/TitleLocalCache.php @@ -28,7 +28,7 @@ class EchoTitleLocalCache extends EchoLocalCache { if ( $lookups ) { $titles = Title::newFromIDs( $lookups ); foreach ( $titles as $title ) { - yield $title->getArticleId() => $title; + yield $title->getArticleID() => $title; } } } diff --git a/includes/controller/NotificationController.php b/includes/controller/NotificationController.php index f05396387..71f88d7d0 100644 --- a/includes/controller/NotificationController.php +++ b/includes/controller/NotificationController.php @@ -293,7 +293,7 @@ class EchoNotificationController { return false; } - $userId = $user->getID(); + $userId = $user->getId(); if ( $userId === 0 ) { return false; // anonymous user } diff --git a/includes/formatters/PageLinkedPresentationModel.php b/includes/formatters/PageLinkedPresentationModel.php index ceb53e5c2..ffe0f1208 100644 --- a/includes/formatters/PageLinkedPresentationModel.php +++ b/includes/formatters/PageLinkedPresentationModel.php @@ -95,7 +95,7 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel { if ( isset( $extra['link-from-namespace'] ) && isset( $extra['link-from-title'] ) ) { $title = Title::makeTitleSafe( $extra['link-from-namespace'], $extra['link-from-title'] ); if ( $title ) { - return $title->getArticleId(); + return $title->getArticleID(); } } return 0; @@ -103,7 +103,7 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel { private function getPageFrom() { if ( !$this->pageFrom ) { - $this->pageFrom = Title::newFromId( $this->getLinkedPageId( $this->event ) ); + $this->pageFrom = Title::newFromID( $this->getLinkedPageId( $this->event ) ); } return $this->pageFrom; } diff --git a/includes/mapper/NotificationMapper.php b/includes/mapper/NotificationMapper.php index 24f655a2e..24bb5c71d 100644 --- a/includes/mapper/NotificationMapper.php +++ b/includes/mapper/NotificationMapper.php @@ -200,7 +200,7 @@ class EchoNotificationMapper extends EchoAbstractMapper { // the notification volume is in a reasonable amount for such case. The other option // is to denormalize notification table with event_type and lookup index. $conds = [ - 'notification_user' => $user->getID(), + 'notification_user' => $user->getId(), 'event_type' => $eventTypes, 'event_deleted' => 0, ] + $conds; @@ -340,7 +340,7 @@ class EchoNotificationMapper extends EchoAbstractMapper { $dbr = $this->dbFactory->getEchoDb( DB_REPLICA ); $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); - $domainId = $dbw->getDomainId(); + $domainId = $dbw->getDomainID(); $iterator = new BatchRowIterator( $dbr, diff --git a/includes/model/TargetPage.php b/includes/model/TargetPage.php index e9ea4d2bb..4134f039b 100644 --- a/includes/model/TargetPage.php +++ b/includes/model/TargetPage.php @@ -92,7 +92,7 @@ class EchoTargetPage extends EchoAbstractEntity { */ public function getTitle() { if ( $this->title === false ) { - $this->title = Title::newFromId( $this->pageId ); + $this->title = Title::newFromID( $this->pageId ); } return $this->title; diff --git a/includes/special/SpecialNotificationsMarkRead.php b/includes/special/SpecialNotificationsMarkRead.php index 013b74809..bac4d8a84 100644 --- a/includes/special/SpecialNotificationsMarkRead.php +++ b/includes/special/SpecialNotificationsMarkRead.php @@ -148,6 +148,6 @@ class SpecialNotificationsMarkRead extends FormSpecialPage { public function onSuccess() { $page = SpecialPage::getTitleFor( 'Notifications' ); - $this->getOutput()->redirect( $page->getFullUrl() ); + $this->getOutput()->redirect( $page->getFullURL() ); } } diff --git a/maintenance/generateSampleNotifications.php b/maintenance/generateSampleNotifications.php index c17bef99b..43b3ebf16 100644 --- a/maintenance/generateSampleNotifications.php +++ b/maintenance/generateSampleNotifications.php @@ -329,7 +329,7 @@ class GenerateSampleNotifications extends Maintenance { [ 'type' => 'user-rights', 'extra' => [ - 'user' => $user->getID(), + 'user' => $user->getId(), 'add' => $add, 'remove' => $remove, 'reason' => 'This is the [[reason]] for changing your user rights.', diff --git a/tests/phpunit/AttributeManagerTest.php b/tests/phpunit/AttributeManagerTest.php index 93871b9ea..3dc7f76e2 100644 --- a/tests/phpunit/AttributeManagerTest.php +++ b/tests/phpunit/AttributeManagerTest.php @@ -324,19 +324,19 @@ class EchoAttributeManagerTest extends MediaWikiTestCase { ]; $manager = new EchoAttributeManager( $notif, $category, $defaultNotifyTypeAvailability, $notifyTypeAvailabilityByCategory ); $expected = [ 'event_one', 'event_three', 'event_four' ]; - $actual = $manager->getUserEnabledEventsBySections( $this->mockUser(), 'web', [ 'alert' ] ); + $actual = $manager->getUserEnabledEventsbySections( $this->mockUser(), 'web', [ 'alert' ] ); sort( $expected ); sort( $actual ); $this->assertEquals( $expected, $actual ); $expected = [ 'event_two' ]; - $actual = $manager->getUserEnabledEventsBySections( $this->mockUser(), 'web', [ 'message' ] ); + $actual = $manager->getUserEnabledEventsbySections( $this->mockUser(), 'web', [ 'message' ] ); sort( $expected ); sort( $actual ); $this->assertEquals( $expected, $actual ); $expected = [ 'event_one', 'event_two', 'event_three', 'event_four' ]; - $actual = $manager->getUserEnabledEventsBySections( $this->mockUser(), 'web', + $actual = $manager->getUserEnabledEventsbySections( $this->mockUser(), 'web', [ 'message', 'alert' ] ); sort( $expected ); sort( $actual );