From: Daimona Eaytoy Date: Tue, 17 Sep 2019 10:20:50 +0000 (+0200) Subject: site: Make getPageUrl consistently return null X-Git-Tag: 1.34.0-rc.0~120^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=67f8131534e8aa3c2085ed3ad3a8a2b0cf5dcbac;ds=sidebyside site: Make getPageUrl consistently return null This was pointed out in Ia8443e575c22f47a6d8c63038f4e7ac36815fc27. The method checks if $url is false, but that's never the case because getLinkPath returns string|null. Change-Id: I7850bff928f861d796879301ba0b4e575919407e --- diff --git a/includes/site/MediaWikiSite.php b/includes/site/MediaWikiSite.php index 3e2a9a2b40..aa7a6d6caf 100644 --- a/includes/site/MediaWikiSite.php +++ b/includes/site/MediaWikiSite.php @@ -176,13 +176,13 @@ class MediaWikiSite extends Site { * * @param string|bool $pageName Page name or false (default: false) * - * @return string|bool|null + * @return string|null */ public function getPageUrl( $pageName = false ) { $url = $this->getLinkPath(); - if ( $url === false ) { - return false; + if ( $url === null ) { + return null; } if ( $pageName !== false ) { diff --git a/includes/site/Site.php b/includes/site/Site.php index 10711a6fbb..401f6e4829 100644 --- a/includes/site/Site.php +++ b/includes/site/Site.php @@ -354,7 +354,7 @@ class Site implements Serializable { /** * Returns the full URL for the given page on the site. - * Or false if the needed information is not known. + * Or null if the needed information is not known. * * This generated URL is usually based upon the path returned by getLinkPath(), * but this is not a requirement. @@ -365,13 +365,13 @@ class Site implements Serializable { * * @param bool|string $pageName * - * @return string|bool|null + * @return string|null */ public function getPageUrl( $pageName = false ) { $url = $this->getLinkPath(); - if ( $url === false ) { - return false; + if ( $url === null ) { + return null; } if ( $pageName !== false ) {