From 460bcf81e752ffd7eb3994fb331324e874f1ca15 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Mon, 13 May 2019 12:09:41 +0100 Subject: [PATCH] build: Upgrade mediawiki/mediawiki-phan-config from 0.5.0 to 0.6.0 and make pass Fix five instances of PhanPluginDuplicateConditionalNullCoalescing; escape the rest for now. Bug: T219114 Change-Id: Ic4bb30c43c5315ce6b878b37b432c6e219414f8b --- composer.json | 2 +- includes/ForkController.php | 1 + includes/Revision/RevisionStore.php | 1 + includes/changes/ChangesList.php | 2 +- includes/jobqueue/jobs/ActivityUpdateJob.php | 4 +--- includes/libs/filebackend/SwiftFileBackend.php | 4 +--- includes/rcfeed/FormattedRCFeed.php | 1 + includes/specials/SpecialLog.php | 2 +- includes/specials/pagers/UsersPager.php | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 1c7f22aefb..b1242c5d62 100644 --- a/composer.json +++ b/composer.json @@ -75,7 +75,7 @@ "wikimedia/avro": "1.8.0", "wikimedia/testing-access-wrapper": "~1.0", "wmde/hamcrest-html-matchers": "^0.1.0", - "mediawiki/mediawiki-phan-config": "0.5.0" + "mediawiki/mediawiki-phan-config": "0.6.0" }, "replace": { "symfony/polyfill-ctype": "1.99", diff --git a/includes/ForkController.php b/includes/ForkController.php index cc16964e1f..85f3a7dc63 100644 --- a/includes/ForkController.php +++ b/includes/ForkController.php @@ -123,6 +123,7 @@ class ForkController { pcntl_signal_dispatch(); } else { declare( ticks = 1 ) { + // @phan-suppress-next-line PhanPluginDuplicateExpressionAssignment $status = $status; } } diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php index ea4cf88825..29d7848455 100644 --- a/includes/Revision/RevisionStore.php +++ b/includes/Revision/RevisionStore.php @@ -1912,6 +1912,7 @@ class RevisionStore $this->initializeMutableRevisionFromArray( $revision, $fields ); if ( isset( $fields['content'] ) && is_array( $fields['content'] ) ) { + // @phan-suppress-next-line PhanTypeNoPropertiesForeach foreach ( $fields['content'] as $role => $content ) { $revision->setContent( $role, $content ); } diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 184a2c10e6..6f6887bfa3 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -411,7 +411,7 @@ class ChangesList extends ContextSource { $date = $lang->userTimeAndDate( $ts, $user ); if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) { $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink( - $title !== null ? $title : $rev->getTitle(), + $title ?? $rev->getTitle(), $date, [ 'class' => 'mw-changeslist-date' ], [ 'oldid' => $rev->getId() ] diff --git a/includes/jobqueue/jobs/ActivityUpdateJob.php b/includes/jobqueue/jobs/ActivityUpdateJob.php index 9b085108be..4de72a9b12 100644 --- a/includes/jobqueue/jobs/ActivityUpdateJob.php +++ b/includes/jobqueue/jobs/ActivityUpdateJob.php @@ -59,9 +59,7 @@ class ActivityUpdateJob extends Job { } protected function updateWatchlistNotification() { - $casTimestamp = ( $this->params['notifTime'] !== null ) - ? $this->params['notifTime'] - : $this->params['curTime']; + $casTimestamp = $this->params['notifTime'] ?? $this->params['curTime']; $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'watchlist', diff --git a/includes/libs/filebackend/SwiftFileBackend.php b/includes/libs/filebackend/SwiftFileBackend.php index 4ba1e1c4ee..25878121ed 100644 --- a/includes/libs/filebackend/SwiftFileBackend.php +++ b/includes/libs/filebackend/SwiftFileBackend.php @@ -1707,9 +1707,7 @@ class SwiftFileBackend extends FileBackendStore { if ( $rcode >= 200 && $rcode <= 299 ) { // OK $this->authCreds = [ 'auth_token' => $rhdrs['x-auth-token'], - 'storage_url' => ( $this->swiftStorageUrl !== null ) - ? $this->swiftStorageUrl - : $rhdrs['x-storage-url'] + 'storage_url' => $this->swiftStorageUrl ?? $rhdrs['x-storage-url'] ]; $this->srvCache->set( $cacheKey, $this->authCreds, ceil( $this->authTTL / 2 ) ); diff --git a/includes/rcfeed/FormattedRCFeed.php b/includes/rcfeed/FormattedRCFeed.php index afe900d09c..d0b7ae3220 100644 --- a/includes/rcfeed/FormattedRCFeed.php +++ b/includes/rcfeed/FormattedRCFeed.php @@ -53,6 +53,7 @@ abstract class FormattedRCFeed extends RCFeed { public function notify( RecentChange $rc, $actionComment = null ) { $params = $this->params; /** @var RCFeedFormatter $formatter */ + // @phan-suppress-next-line PhanTypeExpectedObjectOrClassName $formatter = is_object( $params['formatter'] ) ? $params['formatter'] : new $params['formatter']; $line = $formatter->getLine( $params, $rc, $actionComment ); diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index 21c166c65d..2f0c2ced53 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -185,7 +185,7 @@ class SpecialLog extends SpecialPage { */ private function parseParams( FormOptions $opts, $par ) { # Get parameters - $par = $par !== null ? $par : ''; + $par = $par ?? ''; $parms = explode( '/', $par ); $symsForAll = [ '*', 'all' ]; if ( $parms[0] != '' && diff --git a/includes/specials/pagers/UsersPager.php b/includes/specials/pagers/UsersPager.php index 4453772fb2..d08eb89b2a 100644 --- a/includes/specials/pagers/UsersPager.php +++ b/includes/specials/pagers/UsersPager.php @@ -49,7 +49,7 @@ class UsersPager extends AlphabeticPager { } $request = $this->getRequest(); - $par = ( $par !== null ) ? $par : ''; + $par = $par ?? ''; $parms = explode( '/', $par ); $symsForAll = [ '*', 'user' ]; -- 2.20.1