X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FWikitextContent.php;h=92967282c465a512edc40c9c1c71f16c28bd8235;hb=6c9a2923fe1ee3a65cb027be5e781772f2b12fbd;hp=89e93560526f02684c0a43adb8c009e3db0f94fe;hpb=3e9d3ec8c208287ded41fcce0adbcf179edb9f39;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index 89e9356052..942390f68f 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -38,7 +38,7 @@ class WikitextContent extends TextContent { } /** - * @param string|number $sectionId + * @param string|int $sectionId * * @return Content|bool|null * @@ -58,7 +58,7 @@ class WikitextContent extends TextContent { } /** - * @param string|number|null|bool $sectionId + * @param string|int|null|bool $sectionId * @param Content $with * @param string $sectionTitle * @@ -68,7 +68,6 @@ class WikitextContent extends TextContent { * @see Content::replaceSection() */ public function replaceSection( $sectionId, Content $with, $sectionTitle = '' ) { - $myModelId = $this->getModel(); $sectionModelId = $with->getModel(); @@ -89,7 +88,7 @@ class WikitextContent extends TextContent { # Inserting a new section $subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' ) ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : ''; - if ( Hooks::run( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) { + if ( Hooks::run( 'PlaceNewSection', [ $this, $oldtext, $subject, &$text ] ) ) { $text = strlen( trim( $oldtext ) ) > 0 ? "{$oldtext}\n\n{$subject}{$text}" : "{$subject}{$text}"; @@ -138,7 +137,6 @@ class WikitextContent extends TextContent { $text = $this->getNativeData(); $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts ); - rtrim( $pst ); return ( $text === $pst ) ? $this : new static( $pst ); } @@ -153,7 +151,7 @@ class WikitextContent extends TextContent { * * @return Content */ - public function preloadTransform( Title $title, ParserOptions $popts, $params = array() ) { + public function preloadTransform( Title $title, ParserOptions $popts, $params = [] ) { global $wgParser; $text = $this->getNativeData(); @@ -180,7 +178,7 @@ class WikitextContent extends TextContent { if ( $wgMaxRedirects < 1 ) { // redirects are disabled, so quit early - $this->redirectTargetAndText = array( null, $this->getNativeData() ); + $this->redirectTargetAndText = [ null, $this->getNativeData() ]; return $this->redirectTargetAndText; } @@ -190,7 +188,7 @@ class WikitextContent extends TextContent { // Extract the first link and see if it's usable // Ensure that it really does come directly after #REDIRECT // Some older redirects included a colon, so don't freak about that! - $m = array(); + $m = []; if ( preg_match( '!^\s*:?\s*\[{2}(.*?)(?:\|.*?)?\]{2}\s*!', $text, $m ) ) { // Strip preceding colon used to "escape" categories, etc. // and URL-decode links @@ -201,16 +199,16 @@ class WikitextContent extends TextContent { $title = Title::newFromText( $m[1] ); // If the title is a redirect to bad special pages or is invalid, return null if ( !$title instanceof Title || !$title->isValidRedirectTarget() ) { - $this->redirectTargetAndText = array( null, $this->getNativeData() ); + $this->redirectTargetAndText = [ null, $this->getNativeData() ]; return $this->redirectTargetAndText; } - $this->redirectTargetAndText = array( $title, substr( $text, strlen( $m[0] ) ) ); + $this->redirectTargetAndText = [ $title, substr( $text, strlen( $m[0] ) ) ]; return $this->redirectTargetAndText; } } - $this->redirectTargetAndText = array( null, $this->getNativeData() ); + $this->redirectTargetAndText = [ null, $this->getNativeData() ]; return $this->redirectTargetAndText; } @@ -258,10 +256,10 @@ class WikitextContent extends TextContent { * Returns true if this content is not a redirect, and this content's text * is countable according to the criteria defined by $wgArticleCountMethod. * - * @param bool $hasLinks If it is known whether this content contains + * @param bool|null $hasLinks If it is known whether this content contains * links, provide this information here, to avoid redundant parsing to * find out (default: null). - * @param Title $title Optional title, defaults to the title from the current main request. + * @param Title|null $title Optional title, defaults to the title from the current main request. * * @return bool */