Merge "objectcache: make RedisBagOStuff pass all tests"
[lhc/web/wiklou.git] / includes / page / ImagePage.php
index 1dcdc65..81677d4 100644 (file)
@@ -539,13 +539,13 @@ class ImagePage extends Article {
                                // The dirmark, however, must not be immediately adjacent
                                // to the filename, because it can get copied with it.
                                // See T27277.
-                               // @codingStandardsIgnoreStart Ignore long line
+                               // phpcs:disable Generic.Files.LineLength
                                $out->addWikiText( <<<EOT
 <div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
 <div class="mediaWarning">$warning</div>
 EOT
                                );
-                               // @codingStandardsIgnoreEnd
+                               // phpcs:enable
                        } else {
                                $out->addWikiText( <<<EOT
 <div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
@@ -632,7 +632,7 @@ EOT
         * @param string $sizeLinkBigImagePreview HTML for the current size
         * @return string HTML output
         */
-       private function getThumbPrevText( $params, $sizeLinkBigImagePreview ) {
+       protected function getThumbPrevText( $params, $sizeLinkBigImagePreview ) {
                if ( $sizeLinkBigImagePreview ) {
                        // Show a different message of preview is different format from original.
                        $previewTypeDiffers = false;
@@ -670,7 +670,7 @@ EOT
         * @param int $height
         * @return string
         */
-       private function makeSizeLink( $params, $width, $height ) {
+       protected function makeSizeLink( $params, $width, $height ) {
                $params['width'] = $width;
                $params['height'] = $height;
                $thumbnail = $this->displayImg->transform( $params );
@@ -1015,11 +1015,8 @@ EOT
         * @return int Result of string comparison, or namespace comparison
         */
        protected function compare( $a, $b ) {
-               if ( $a->page_namespace == $b->page_namespace ) {
-                       return strcmp( $a->page_title, $b->page_title );
-               } else {
-                       return $a->page_namespace - $b->page_namespace;
-               }
+               return $a->page_namespace <=> $b->page_namespace
+                       ?: strcmp( $a->page_title, $b->page_title );
        }
 
        /**
@@ -1045,9 +1042,8 @@ EOT
                        $option = 0;
                }
 
-               return isset( $wgImageLimits[$option] )
-                       ? $wgImageLimits[$option]
-                       : [ 800, 600 ]; // if nothing is set, fallback to a hardcoded default
+               // if nothing is set, fallback to a hardcoded default
+               return $wgImageLimits[$option] ?? [ 800, 600 ];
        }
 
        /**