Fix misc phan errors by adjusting documentation (#8)
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 6 Apr 2019 06:31:16 +0000 (23:31 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 6 Apr 2019 06:31:16 +0000 (23:31 -0700)
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
includes/CommentStore.php
includes/logging/LogEntry.php

index 37b2153..64197bf 100644 (file)
@@ -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
index 1a60bb7..4a673c4 100644 (file)
@@ -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 );
index 5cad31f..c5e4a92 100644 (file)
@@ -100,7 +100,7 @@ interface LogEntry {
        /**
         * Get the access restriction.
         *
-        * @return string
+        * @return int
         */
        public function getDeleted();