Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/254165

Change subject: EventMapper: Always return an array
......................................................................

EventMapper: Always return an array

It's basically impossible for DatabaseBase::select() to return false now
that ignoreErrors() is protected. So always return an array so callers
don't have to worry about false.

Change-Id: I9ca8511585403d8c0ec262898ad4e61c2b038d51
---
M includes/mapper/EventMapper.php
1 file changed, 6 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/65/254165/1

diff --git a/includes/mapper/EventMapper.php b/includes/mapper/EventMapper.php
index 3bd90d6..f75b323 100644
--- a/includes/mapper/EventMapper.php
+++ b/includes/mapper/EventMapper.php
@@ -65,7 +65,7 @@
         * @param $type string distribution type
         * @param $order string 'ASC'/'DESC'
         * @param $limit int
-        * @return EchoEvent[]|bool
+        * @return EchoEvent[]
         */
        public function fetchByUserBundleHash( User $user, $bundleHash, $type = 
'web', $order = 'DESC', $limit = 250 ) {
                $dbr = $this->dbFactory->getEchoDb( DB_SLAVE );
@@ -107,16 +107,12 @@
                        );
                }
 
-               if ( $res ) {
-                       $data = array();
-                       foreach ( $res as $row ) {
-                               $data[] = EchoEvent::newFromRow( $row );
-                       }
-
-                       return $data;
-               } else {
-                       return false;
+               $data = array();
+               foreach ( $res as $row ) {
+                       $data[] = EchoEvent::newFromRow( $row );
                }
+
+               return $data;
        }
 
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/254165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ca8511585403d8c0ec262898ad4e61c2b038d51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to