Clean up SpecialFilepath.
authorC. Scott Ananian <cscott@cscott.net>
Tue, 16 Apr 2013 21:12:15 +0000 (17:12 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Wed, 17 Apr 2013 15:40:58 +0000 (11:40 -0400)
Prompted by comments on https://gerrit.wikimedia.org/r/59050
which identified problems with code lifted directly from SpecialFilepath.

Change-Id: Iab8a5d3d007b3aca72b7c6c1145d830a74b4399e

includes/specials/SpecialFilepath.php

index bbcced2..dc56b5a 100644 (file)
@@ -37,11 +37,11 @@ class SpecialFilepath extends SpecialPage {
                $this->outputHeader();
 
                $request = $this->getRequest();
-               $file = !is_null( $par ) ? $par : $request->getText( 'file' );
+               $file = $par ?: $request->getText( 'file' );
 
                $title = Title::newFromText( $file, NS_FILE );
 
-               if ( ! $title instanceof Title || $title->getNamespace() != NS_FILE ) {
+               if ( !( $title instanceof Title ) || $title->getNamespace() != NS_FILE ) {
                        $this->showForm( $title );
                } else {
                        $file = wfFindFile( $title );
@@ -70,7 +70,7 @@ class SpecialFilepath extends SpecialPage {
        }
 
        /**
-        * @param $title Title
+        * @param Title $title Title requested, or null.
         */
        function showForm( $title ) {
                global $wgScript;