Merge "rdbms: fix some phpstorm warnings database classes"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 13 Jul 2019 23:22:51 +0000 (23:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 13 Jul 2019 23:22:51 +0000 (23:22 +0000)
includes/libs/rdbms/database/DatabasePostgres.php
includes/poolcounter/PoolCounterWork.php

index cef3922..840b428 100644 (file)
@@ -884,9 +884,12 @@ __INDEXATTR__;
        }
 
        /**
+        * @param string $prefix Only show tables with this prefix, e.g. mw_
+        * @param string $fname Calling function name
+        * @return string[]
         * @suppress SecurityCheck-SQLInjection array_map not recognized T204911
         */
-       public function listTables( $prefix = null, $fname = __METHOD__ ) {
+       public function listTables( $prefix = '', $fname = __METHOD__ ) {
                $eschemas = implode( ',', array_map( [ $this, 'addQuotes' ], $this->getCoreSchemas() ) );
                $result = $this->query(
                        "SELECT DISTINCT tablename FROM pg_tables WHERE schemaname IN ($eschemas)", $fname );
@@ -895,7 +898,7 @@ __INDEXATTR__;
                foreach ( $result as $table ) {
                        $vars = get_object_vars( $table );
                        $table = array_pop( $vars );
-                       if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
+                       if ( $prefix == '' || strpos( $table, $prefix ) === 0 ) {
                                $endArray[] = $table;
                        }
                }
index 16e4397..7379679 100644 (file)
@@ -29,6 +29,8 @@ abstract class PoolCounterWork {
        protected $type = 'generic';
        /** @var bool */
        protected $cacheable = false; // does this override getCachedWork() ?
+       /** @var PoolCounter */
+       private $poolCounter;
 
        /**
         * @param string $type The class of actions to limit concurrency for (task type)