* @return mixed Property value or null if not found
*/
public function getProperty( $name ) {
- if ( isset( $this->mProperties[$name] ) ) {
- return $this->mProperties[$name];
- } else {
- return null;
- }
+ return $this->mProperties[$name] ?? null;
}
/**
);
# Add the results to the link cache
- $lb->addResultToCache( LinkCache::singleton(), $res );
+ $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+ $lb->addResultToCache( $linkCache, $res );
return $res;
}
foreach ( $errors as $error ) {
$text .= '<li>';
- $text .= call_user_func_array( [ $this, 'msg' ], $error )->plain();
+ $text .= $this->msg( ...$error )->plain();
$text .= "</li>\n";
}
$text .= '</ul>';
} else {
$text .= "<div class=\"permissions-errors\">\n" .
- call_user_func_array( [ $this, 'msg' ], reset( $errors ) )->plain() .
+ $this->msg( ...reset( $errors ) )->plain() .
"\n</div>";
}
// Pre-process information
$separatorTransTable = $lang->separatorTransformTable();
- $separatorTransTable = $separatorTransTable ? $separatorTransTable : [];
+ $separatorTransTable = $separatorTransTable ?: [];
$compactSeparatorTransTable = [
implode( "\t", array_keys( $separatorTransTable ) ),
implode( "\t", $separatorTransTable ),
];
$digitTransTable = $lang->digitTransformTable();
- $digitTransTable = $digitTransTable ? $digitTransTable : [];
+ $digitTransTable = $digitTransTable ?: [];
$compactDigitTransTable = [
implode( "\t", array_keys( $digitTransTable ) ),
implode( "\t", $digitTransTable ),
}
if ( $this->CSPNonce === null ) {
// XXX It might be expensive to generate randomness
- // on every request, on windows.
- $rand = MWCryptRand::generate( 15 );
+ // on every request, on Windows.
+ $rand = random_bytes( 15 );
$this->CSPNonce = base64_encode( $rand );
}
return $this->CSPNonce;