From 5f8d76336dba61aa6ce495a92e30367368aaa651 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 5 Apr 2019 23:31:16 -0700 Subject: [PATCH] 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 --- .phan/config.php | 4 ---- includes/CommentStore.php | 1 + includes/logging/LogEntry.php | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) 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(); -- 2.20.1