From: Fomafix Date: Fri, 27 Jul 2018 20:20:39 +0000 (+0200) Subject: Add type hint for ParserOutput X-Git-Tag: 1.34.0-rc.0~4481^2 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=6a022c8d2038a490ed8ee262be8043bcf40fc4e1;p=lhc%2Fweb%2Fwiklou.git Add type hint for ParserOutput EditPage::getPreviewLimitReport is called by EditPage::showEditForm with $output = null. Specify this in the @param tag and allow this by a default value. Change-Id: Iec8905aab736a1f254a57853c7cab935d008653e --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 16f1c5ae4e..2022636cf9 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3588,10 +3588,10 @@ ERROR; * Get the Limit report for page previews * * @since 1.22 - * @param ParserOutput $output ParserOutput object from the parse + * @param ParserOutput|null $output ParserOutput object from the parse * @return string HTML */ - public static function getPreviewLimitReport( $output ) { + public static function getPreviewLimitReport( ParserOutput $output = null ) { global $wgLang; if ( !$output || !$output->getLimitReportData() ) { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1dc996aaa4..ec13bb98cc 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1771,7 +1771,7 @@ class OutputPage extends ContextSource { * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputMetadata( $parserOutput ) { + public function addParserOutputMetadata( ParserOutput $parserOutput ) { $this->mLanguageLinks = array_merge( $this->mLanguageLinks, $parserOutput->getLanguageLinks() ); $this->addCategoryLinks( $parserOutput->getCategories() ); @@ -1848,7 +1848,7 @@ class OutputPage extends ContextSource { * @param ParserOutput $parserOutput * @param array $poOptions Options to ParserOutput::getText() */ - public function addParserOutputContent( $parserOutput, $poOptions = [] ) { + public function addParserOutputContent( ParserOutput $parserOutput, $poOptions = [] ) { $this->addParserOutputText( $parserOutput, $poOptions ); $this->addModules( $parserOutput->getModules() ); @@ -1865,7 +1865,7 @@ class OutputPage extends ContextSource { * @param ParserOutput $parserOutput * @param array $poOptions Options to ParserOutput::getText() */ - public function addParserOutputText( $parserOutput, $poOptions = [] ) { + public function addParserOutputText( ParserOutput $parserOutput, $poOptions = [] ) { $text = $parserOutput->getText( $poOptions ); // Avoid PHP 7.1 warning of passing $this by reference $outputPage = $this; @@ -1879,7 +1879,7 @@ class OutputPage extends ContextSource { * @param ParserOutput $parserOutput * @param array $poOptions Options to ParserOutput::getText() */ - function addParserOutput( $parserOutput, $poOptions = [] ) { + function addParserOutput( ParserOutput $parserOutput, $poOptions = [] ) { $this->addParserOutputMetadata( $parserOutput ); $this->addParserOutputText( $parserOutput, $poOptions ); } diff --git a/includes/page/Article.php b/includes/page/Article.php index 49912c77dd..3a7b18e4c0 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -750,7 +750,7 @@ class Article implements Page { * @return array The policy that should be set * @todo actions other than 'view' */ - public function getRobotPolicy( $action, $pOutput = null ) { + public function getRobotPolicy( $action, ParserOutput $pOutput = null ) { global $wgArticleRobotPolicies, $wgNamespaceRobotPolicies, $wgDefaultRobotPolicy; $ns = $this->getTitle()->getNamespace(); diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index e6326e6c69..5e6081d33d 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -294,7 +294,13 @@ class ParserCache { * @param string|null $cacheTime TS_MW timestamp when the cache was generated * @param int|null $revId Revision ID that was parsed */ - public function save( $parserOutput, $page, $popts, $cacheTime = null, $revId = null ) { + public function save( + ParserOutput $parserOutput, + $page, + $popts, + $cacheTime = null, + $revId = null + ) { $expire = $parserOutput->getCacheExpiry(); if ( $expire > 0 && !$this->mMemc instanceof EmptyBagOStuff ) { $cacheTime = $cacheTime ?: wfTimestampNow();