docs/kss/package.json: Update Gerrit /r/p/ link to /r/
[lhc/web/wiklou.git] / includes / api / ApiQueryBase.php
index d9fe50b..d955b56 100644 (file)
@@ -157,16 +157,14 @@ abstract class ApiQueryBase extends ApiBase {
         */
        protected function addTables( $tables, $alias = null ) {
                if ( is_array( $tables ) ) {
-                       if ( !is_null( $alias ) ) {
+                       if ( $alias !== null ) {
                                ApiBase::dieDebug( __METHOD__, 'Multiple table aliases not supported' );
                        }
                        $this->tables = array_merge( $this->tables, $tables );
+               } elseif ( $alias !== null ) {
+                       $this->tables[$alias] = $tables;
                } else {
-                       if ( !is_null( $alias ) ) {
-                               $this->tables[$alias] = $tables;
-                       } else {
-                               $this->tables[] = $tables;
-                       }
+                       $this->tables[] = $tables;
                }
        }
 
@@ -277,7 +275,7 @@ abstract class ApiQueryBase extends ApiBase {
                if ( count( $ids ) ) {
                        $ids = $this->filterIDs( [ [ $table, $field ] ], $ids );
 
-                       if ( !count( $ids ) ) {
+                       if ( $ids === [] ) {
                                // Return nothing, no IDs are valid
                                $this->where[] = '0 = 1';
                        } else {
@@ -510,7 +508,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $prefix Module prefix
         */
        public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
-               $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
+               $arr[$prefix . 'ns'] = (int)$title->getNamespace();
                $arr[$prefix . 'title'] = $title->getPrefixedText();
        }
 
@@ -524,7 +522,7 @@ abstract class ApiQueryBase extends ApiBase {
                $result = $this->getResult();
                ApiResult::setIndexedTagName( $data, $this->getModulePrefix() );
 
-               return $result->addValue( [ 'query', 'pages', intval( $pageId ) ],
+               return $result->addValue( [ 'query', 'pages', (int)$pageId ],
                        $this->getModuleName(),
                        $data );
        }