Merge "Collapse some unnecessary else conditions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 21 Sep 2018 02:20:23 +0000 (02:20 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 21 Sep 2018 02:20:23 +0000 (02:20 +0000)
1  2 
includes/specialpage/SpecialPageFactory.php

@@@ -34,6 -34,7 +34,6 @@@ use RequestContext
  use SpecialPage;
  use Title;
  use User;
 -use Wikimedia\ObjectFactory;
  
  /**
   * Factory for handling the special page list and generating SpecialPage objects.
@@@ -400,6 -401,16 +400,6 @@@ class SpecialPageFactory 
                        } elseif ( is_string( $rec ) ) {
                                $className = $rec;
                                $page = new $className;
 -                      } elseif ( is_array( $rec ) ) {
 -                              $className = array_shift( $rec );
 -                              // @deprecated, officially since 1.18, unofficially since forever
 -                              wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
 -                                      "define a subclass of SpecialPage instead.", '1.18' );
 -                              $page = ObjectFactory::getObjectFromSpec( [
 -                                      'class' => $className,
 -                                      'args' => $rec,
 -                                      'closure_expansion' => false,
 -                              ] );
                        } elseif ( $rec instanceof SpecialPage ) {
                                $page = $rec; // XXX: we should deep clone here
                        } else {
  
                        if ( $page instanceof SpecialPage ) {
                                return $page;
-                       } else {
-                               // It's not a classname, nor a callback, nor a legacy constructor array,
-                               // nor a special page object. Give up.
-                               wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
-                               return null;
                        }
  
-               } else {
-                       return null;
+                       // It's not a classname, nor a callback, nor a legacy constructor array,
+                       // nor a special page object. Give up.
+                       wfLogWarning( "Cannot instantiate special page $realName: bad spec!" );
                }
+               return null;
        }
  
        /**
                                $context->getOutput()->redirect( $url );
  
                                return $title;
-                       } else {
-                               $context->setTitle( $page->getPageTitle( $par ) );
                        }
+                       $context->setTitle( $page->getPageTitle( $par ) );
                } elseif ( !$page->isIncludable() ) {
                        return false;
                }
                list( $name, $subpage ) = $this->resolveAlias( $alias );
                if ( $name != null ) {
                        return SpecialPage::getTitleFor( $name, $subpage );
-               } else {
-                       return null;
                }
+               return null;
        }
  }