# 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}";
*
* @return Content
*/
- public function preloadTransform( Title $title, ParserOptions $popts, $params = array() ) {
+ public function preloadTransform( Title $title, ParserOptions $popts, $params = [] ) {
global $wgParser;
$text = $this->getNativeData();
if ( $wgMaxRedirects < 1 ) {
// redirects are disabled, so quit early
- $this->redirectTargetAndText = array( null, $this->getNativeData() );
+ $this->redirectTargetAndText = [ null, $this->getNativeData() ];
return $this->redirectTargetAndText;
}
// 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
$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;
}
* 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
*/