Merge "block: Avoid use of empty() which doesn't warn on var non-existence"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 23 Mar 2019 18:59:26 +0000 (18:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 23 Mar 2019 18:59:26 +0000 (18:59 +0000)
1  2 
includes/block/BlockRestriction.php

@@@ -73,7 -73,7 +73,7 @@@ class BlockRestriction 
         * @return bool
         */
        public static function insert( array $restrictions ) {
-               if ( empty( $restrictions ) ) {
+               if ( !$restrictions ) {
                        return false;
                }
  
                        $rows[] = $restriction->toRow();
                }
  
-               if ( empty( $rows ) ) {
+               if ( !$rows ) {
                        return false;
                }
  
                $dbw = wfGetDB( DB_MASTER );
  
 -              return $dbw->insert(
 +              $dbw->insert(
                        'ipblocks_restrictions',
                        $rows,
                        __METHOD__,
                        [ 'IGNORE' ]
                );
 +
 +              return true;
        }
  
        /**