Use short array syntax instead of array()

Change-Id: I22f24bf047ff8bb476000bfbf879cc7612c10c27
This commit is contained in:
Florian Schmidt 2016-09-14 17:23:11 +02:00
parent 45d70926ed
commit 12137c66d8
2 changed files with 31 additions and 31 deletions

View file

@ -52,7 +52,7 @@ class CookieWarningHooks {
if ( $moreLink ) {
$moreLink = Html::element(
'a',
array( 'href' => $moreLink ),
[ 'href' => $moreLink ],
$sk->msg( 'cookiewarning-moreinfo-label' )->text()
);
}
@ -62,25 +62,25 @@ class CookieWarningHooks {
}
$tpl->data['headelement'] .= Html::openElement(
'div',
array( 'class' => 'mw-cookiewarning-container' )
[ 'class' => 'mw-cookiewarning-container' ]
) .
Html::openElement(
'div',
array( 'class' => 'mw-cookiewarning-text' )
[ 'class' => 'mw-cookiewarning-text' ]
) .
Html::element(
'span',
array(),
[],
$sk->msg( 'cookiewarning-info' )->text()
) .
$moreLink .
Html::openElement( 'form', array( 'method' => 'POST' ) ) .
Html::openElement( 'form', [ 'method' => 'POST' ] ) .
Html::submitButton(
$sk->msg( 'cookiewarning-ok-label' )->text(),
array(
[
'name' => 'disablecookiewarning',
'class' => 'mw-cookiewarning-dismiss'
)
]
) .
Html::closeElement( 'form' ) .
Html::closeElement( 'div' ) .
@ -122,8 +122,8 @@ class CookieWarningHooks {
*/
public static function onBeforePageDisplay( OutputPage $out ) {
if ( self::showWarning( $out->getContext() ) ) {
$out->addModuleStyles( array( 'ext.CookieWarning.styles' ) );
$out->addModules( array( 'ext.CookieWarning' ) );
$out->addModuleStyles( [ 'ext.CookieWarning.styles' ] );
$out->addModules( [ 'ext.CookieWarning' ] );
}
}
@ -160,10 +160,10 @@ class CookieWarningHooks {
* @return bool
*/
public static function onGetPreferences( User $user, &$defaultPreferences ) {
$defaultPreferences['cookiewarning_dismissed'] = array(
$defaultPreferences['cookiewarning_dismissed'] = [
'type' => 'api',
'default' => '0',
);
];
return true;
}
}

View file

@ -14,10 +14,10 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
public function testOnSkinTemplateOutputPageBeforeExec( $enabled, $morelinkConfig,
$morelinkCookieWarningMsg, $morelinkCookiePolicyMsg, $expectedLink
) {
$this->setMwGlobals( array(
$this->setMwGlobals( [
'wgCookieWarningEnabled' => $enabled,
'wgCookieWarningMoreUrl' => $morelinkConfig,
) );
] );
if ( $morelinkCookieWarningMsg ) {
$title = Title::newFromText( 'cookiewarning-more-link', NS_MEDIAWIKI );
$wikiPage = WikiPage::factory( $title );
@ -50,8 +50,8 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
}
public function providerOnSkinTemplateOutputPageBeforeExec() {
return array(
array(
return [
[
// $wgCookieWarningEnabled
true,
// $wgCookieWarningMoreUrl
@ -62,58 +62,58 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
false,
// expected cookie warning link (when string), nothing if false
'',
),
array(
],
[
false,
'',
false,
false,
false,
),
array(
],
[
true,
'http://google.de',
false,
false,
'<a href="http://google.de">More information</a>',
),
array(
],
[
true,
'',
'http://google.de',
false,
'<a href="http://google.de">More information</a>',
),
array(
],
[
true,
'',
false,
'http://google.de',
'<a href="http://google.de">More information</a>',
),
],
// the config should be the used, if set (no matter if the messages are used or not)
array(
[
true,
'http://google.de',
false,
'http://google123.de',
'<a href="http://google.de">More information</a>',
),
array(
],
[
true,
'http://google.de',
'http://google1234.de',
'http://google123.de',
'<a href="http://google.de">More information</a>',
),
array(
],
[
true,
'',
'http://google.de',
'http://google123.de',
'<a href="http://google.de">More information</a>',
),
);
],
];
}
}