Fix minor issues found with phan
authorWMDE-Fisch <christoph.jauera@wikimedia.de>
Mon, 7 Aug 2017 14:55:20 +0000 (16:55 +0200)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Wed, 9 Aug 2017 20:42:09 +0000 (22:42 +0200)
- fixed PHPDoc
- replaced deprecated function

Bug: T153252
Change-Id: I072a1c1201bd19eafe7c50bbbf32a71fa4a92a46

includes/Revision.php
includes/media/Bitmap.php
includes/page/WikiPage.php

index 537b7c1..88b138d 100644 (file)
@@ -860,7 +860,7 @@ class Revision implements IDBAccessObject {
         *   Revision::FOR_PUBLIC       to be displayed to all users
         *   Revision::FOR_THIS_USER    to be displayed to the given user
         *   Revision::RAW              get the ID regardless of permissions
-        * @param User $user User object to check for, only if FOR_THIS_USER is passed
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
         * @return int
         */
@@ -894,7 +894,7 @@ class Revision implements IDBAccessObject {
         *   Revision::FOR_PUBLIC       to be displayed to all users
         *   Revision::FOR_THIS_USER    to be displayed to the given user
         *   Revision::RAW              get the text regardless of permissions
-        * @param User $user User object to check for, only if FOR_THIS_USER is passed
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
         * @return string
         */
@@ -938,7 +938,7 @@ class Revision implements IDBAccessObject {
         *   Revision::FOR_PUBLIC       to be displayed to all users
         *   Revision::FOR_THIS_USER    to be displayed to the given user
         *   Revision::RAW              get the text regardless of permissions
-        * @param User $user User object to check for, only if FOR_THIS_USER is passed
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
         * @return string
         */
index 0f0b074..1aeead5 100644 (file)
@@ -129,7 +129,7 @@ class BitmapHandler extends TransformationalImageHandler {
         * @param File $image File associated with this thumbnail
         * @param array $params Array with scaler params
         *
-        * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+        * @return MediaTransformError|bool Error object if error occurred, false (=no error) otherwise
         */
        protected function transformImageMagick( $image, $params ) {
                # use ImageMagick
@@ -272,7 +272,7 @@ class BitmapHandler extends TransformationalImageHandler {
         * @param File $image File associated with this thumbnail
         * @param array $params Array with scaler params
         *
-        * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+        * @return MediaTransformError Error|bool object if error occurred, false (=no error) otherwise
         */
        protected function transformImageMagickExt( $image, $params ) {
                global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
@@ -367,7 +367,7 @@ class BitmapHandler extends TransformationalImageHandler {
         * @param File $image File associated with this thumbnail
         * @param array $params Array with scaler params
         *
-        * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+        * @return MediaTransformError Error|bool object if error occurred, false (=no error) otherwise
         */
        protected function transformCustom( $image, $params ) {
                # Use a custom convert command
@@ -399,7 +399,7 @@ class BitmapHandler extends TransformationalImageHandler {
         * @param File $image File associated with this thumbnail
         * @param array $params Array with scaler params
         *
-        * @return MediaTransformError Error object if error occurred, false (=no error) otherwise
+        * @return MediaTransformError|bool Error object if error occurred, false (=no error) otherwise
         */
        protected function transformGd( $image, $params ) {
                # Use PHP's builtin GD library functions.
index c05ba45..af906fb 100644 (file)
@@ -383,11 +383,12 @@ class WikiPage implements Page, IDBAccessObject {
                if ( is_int( $from ) ) {
                        list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from );
                        $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts );
+                       $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
 
                        if ( !$data
                                && $index == DB_REPLICA
-                               && wfGetLB()->getServerCount() > 1
-                               && wfGetLB()->hasOrMadeRecentMasterChanges()
+                               && $loadBalancer->getServerCount() > 1
+                               && $loadBalancer->hasOrMadeRecentMasterChanges()
                        ) {
                                $from = self::READ_LATEST;
                                list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from );