From e7ee0bc0f56c3744bc0893d39f0d89d957bf8275 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sat, 7 Sep 2019 16:38:07 +0200 Subject: [PATCH] Better docs to make phan happy Change-Id: I8a9a6330cf1f889cbb77dfc28c93774204767323 --- includes/config/ConfigFactory.php | 3 ++- includes/config/ConfigRepository.php | 2 ++ includes/deferred/CdnCacheUpdate.php | 3 ++- includes/deferred/JobQueueEnqueueUpdate.php | 3 ++- includes/deferred/MessageCacheUpdate.php | 3 ++- includes/deferred/SiteStatsUpdate.php | 1 + includes/deferred/UserEditCountUpdate.php | 1 + includes/libs/StatusValue.php | 2 +- 8 files changed, 13 insertions(+), 5 deletions(-) diff --git a/includes/config/ConfigFactory.php b/includes/config/ConfigFactory.php index 696bbf462f..bd174b2ed6 100644 --- a/includes/config/ConfigFactory.php +++ b/includes/config/ConfigFactory.php @@ -66,7 +66,8 @@ class ConfigFactory implements SalvageableService { public function salvage( SalvageableService $other ) { Assert::parameterType( self::class, $other, '$other' ); - /** @var ConfigFactory $other */ + /** @var self $other */ + '@phan-var self $other'; foreach ( $other->factoryFunctions as $name => $otherFunc ) { if ( !isset( $this->factoryFunctions[$name] ) ) { continue; diff --git a/includes/config/ConfigRepository.php b/includes/config/ConfigRepository.php index d48eb0ec43..ceb3944d17 100644 --- a/includes/config/ConfigRepository.php +++ b/includes/config/ConfigRepository.php @@ -188,6 +188,8 @@ class ConfigRepository implements SalvageableService { */ public function salvage( SalvageableService $other ) { Assert::parameterType( self::class, $other, '$other' ); + /** @var self $other */ + '@phan-var self $other'; foreach ( $other->configItems['public'] as $name => $otherConfig ) { if ( isset( $this->configItems['public'][$name] ) ) { diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php index 66ce9a3ddf..ddffaa396b 100644 --- a/includes/deferred/CdnCacheUpdate.php +++ b/includes/deferred/CdnCacheUpdate.php @@ -39,8 +39,9 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate { } public function merge( MergeableUpdate $update ) { - /** @var CdnCacheUpdate $update */ + /** @var self $update */ Assert::parameterType( __CLASS__, $update, '$update' ); + '@phan-var self $update'; $this->urls = array_merge( $this->urls, $update->urls ); } diff --git a/includes/deferred/JobQueueEnqueueUpdate.php b/includes/deferred/JobQueueEnqueueUpdate.php index 1691da216e..d1b592da9d 100644 --- a/includes/deferred/JobQueueEnqueueUpdate.php +++ b/includes/deferred/JobQueueEnqueueUpdate.php @@ -41,8 +41,9 @@ class JobQueueEnqueueUpdate implements DeferrableUpdate, MergeableUpdate { } public function merge( MergeableUpdate $update ) { - /** @var JobQueueEnqueueUpdate $update */ + /** @var self $update */ Assert::parameterType( __CLASS__, $update, '$update' ); + '@phan-var self $update'; foreach ( $update->jobsByDomain as $domain => $jobs ) { $this->jobsByDomain[$domain] = $this->jobsByDomain[$domain] ?? []; diff --git a/includes/deferred/MessageCacheUpdate.php b/includes/deferred/MessageCacheUpdate.php index c499d082f9..7f56a3693e 100644 --- a/includes/deferred/MessageCacheUpdate.php +++ b/includes/deferred/MessageCacheUpdate.php @@ -42,8 +42,9 @@ class MessageCacheUpdate implements DeferrableUpdate, MergeableUpdate { } public function merge( MergeableUpdate $update ) { - /** @var MessageCacheUpdate $update */ + /** @var self $update */ Assert::parameterType( __CLASS__, $update, '$update' ); + '@phan-var self $update'; foreach ( $update->replacements as $code => $messages ) { $this->replacements[$code] = array_merge( $this->replacements[$code] ?? [], $messages ); diff --git a/includes/deferred/SiteStatsUpdate.php b/includes/deferred/SiteStatsUpdate.php index 11e9337093..dbd7c50f0a 100644 --- a/includes/deferred/SiteStatsUpdate.php +++ b/includes/deferred/SiteStatsUpdate.php @@ -56,6 +56,7 @@ class SiteStatsUpdate implements DeferrableUpdate, MergeableUpdate { public function merge( MergeableUpdate $update ) { /** @var SiteStatsUpdate $update */ Assert::parameterType( __CLASS__, $update, '$update' ); + '@phan-var SiteStatsUpdate $update'; foreach ( self::$counters as $field ) { $this->$field += $update->$field; diff --git a/includes/deferred/UserEditCountUpdate.php b/includes/deferred/UserEditCountUpdate.php index 687dfbe907..4333c94042 100644 --- a/includes/deferred/UserEditCountUpdate.php +++ b/includes/deferred/UserEditCountUpdate.php @@ -46,6 +46,7 @@ class UserEditCountUpdate implements DeferrableUpdate, MergeableUpdate { public function merge( MergeableUpdate $update ) { /** @var UserEditCountUpdate $update */ Assert::parameterType( __CLASS__, $update, '$update' ); + '@phan-var UserEditCountUpdate $update'; foreach ( $update->infoByUser as $userId => $info ) { if ( !isset( $this->infoByUser[$userId] ) ) { diff --git a/includes/libs/StatusValue.php b/includes/libs/StatusValue.php index 71a0e348dd..4b381f8de1 100644 --- a/includes/libs/StatusValue.php +++ b/includes/libs/StatusValue.php @@ -93,7 +93,7 @@ class StatusValue { * 1 => object(StatusValue) # The StatusValue with warning messages, only * ] * - * @return StatusValue[] + * @return static[] */ public function splitByErrorType() { $errorsOnlyStatusValue = clone $this; -- 2.20.1