From: Kunal Mehta Date: Sat, 6 Apr 2019 06:31:16 +0000 (-0700) Subject: Fix misc phan errors by adjusting documentation (#8) X-Git-Tag: 1.34.0-rc.0~2111^2~3 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=5f8d76336dba61aa6ce495a92e30367368aaa651;p=lhc%2Fweb%2Fwiklou.git Fix misc phan errors by adjusting documentation (#8) PhanTypeInvalidRightOperand was triggering on ApiQueryBase::showHiddenUsersAddBlockInfo() on the line `$actorQuery['tables'] + $commentQuery['tables']` (and the next one). For whatever reason, phan was unable to automatically understand that the right side was an array (though it was able to understand $actorQuery, which has nearly identical code...), so I added more specific hinting to CommentStore::getJoin() using phan's union types, which resolved the issue. And incorrect documentation on LogEntry::getDeleted() was triggering PhanTypeMismatchBitwiseBinaryOperands since you can't do bitwise operations on a string and an integer. Change-Id: I13b791e4b754ffbc340b55cfb752e2d9226f1949 --- diff --git a/.phan/config.php b/.phan/config.php index 37b21531bf..64197bf30d 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -110,15 +110,11 @@ $cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [ // approximate error count: 7 "PhanTypeInvalidLeftOperandOfIntegerOp", // approximate error count: 2 - "PhanTypeInvalidRightOperand", - // approximate error count: 2 "PhanTypeInvalidRightOperandOfIntegerOp", // approximate error count: 154 "PhanTypeMismatchArgument", // approximate error count: 27 "PhanTypeMismatchArgumentInternal", - // approximate error count: 1 - "PhanTypeMismatchBitwiseBinaryOperands", // approximate error count: 2 "PhanTypeMismatchDimEmpty", // approximate error count: 27 diff --git a/includes/CommentStore.php b/includes/CommentStore.php index 1a60bb7412..4a673c442e 100644 --- a/includes/CommentStore.php +++ b/includes/CommentStore.php @@ -202,6 +202,7 @@ class CommentStore { * - fields: (string[]) to include in the `$vars` to `IDatabase->select()` * - joins: (array) to include in the `$join_conds` to `IDatabase->select()` * All tables, fields, and joins are aliased, so `+` is safe to use. + * @phan-return array{tables:string[],fields:string[],joins:array} */ public function getJoin( $key = null ) { $key = $this->getKey( $key ); diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 5cad31f2fe..c5e4a9204d 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -100,7 +100,7 @@ interface LogEntry { /** * Get the access restriction. * - * @return string + * @return int */ public function getDeleted();