From 94e35779fc2e0e7c193593d4444b3fa7a2527cac Mon Sep 17 00:00:00 2001 From: Paladox Date: Sun, 8 May 2016 23:57:53 +0100 Subject: [PATCH] Update mediawiki/mediawiki-codesniffer to 0.7.1 Change-Id: Ib798b0d8f947fea6b43697280fcebf3cbbe2ae14 --- WikiEditor.hooks.php | 125 +++++++++++++++++++++---------------------- composer.json | 2 +- 2 files changed, 63 insertions(+), 64 deletions(-) diff --git a/WikiEditor.hooks.php b/WikiEditor.hooks.php index 3305c3bb..b9c46602 100644 --- a/WikiEditor.hooks.php +++ b/WikiEditor.hooks.php @@ -13,80 +13,80 @@ class WikiEditorHooks { /* Protected Static Members */ - protected static $features = array( + protected static $features = [ /* Toolbar Features */ - 'toolbar' => array( - 'preferences' => array( + 'toolbar' => [ + 'preferences' => [ // Ideally this key would be 'wikieditor-toolbar' - 'usebetatoolbar' => array( + 'usebetatoolbar' => [ 'type' => 'toggle', 'label-message' => 'wikieditor-toolbar-preference', 'section' => 'editing/editor', - ), - ), - 'requirements' => array( + ], + ], + 'requirements' => [ 'usebetatoolbar' => true, - ), - 'modules' => array( + ], + 'modules' => [ 'ext.wikiEditor.toolbar', - ), - 'stylemodules' => array( + ], + 'stylemodules' => [ 'ext.wikiEditor.toolbar.styles', - ), - ), - 'dialogs' => array( - 'preferences' => array( + ], + ], + 'dialogs' => [ + 'preferences' => [ // Ideally this key would be 'wikieditor-toolbar-dialogs' - 'usebetatoolbar-cgd' => array( + 'usebetatoolbar-cgd' => [ 'type' => 'toggle', 'label-message' => 'wikieditor-toolbar-dialogs-preference', 'section' => 'editing/editor', - ), - ), - 'requirements' => array( + ], + ], + 'requirements' => [ 'usebetatoolbar-cgd' => true, 'usebetatoolbar' => true, - ), - 'modules' => array( + ], + 'modules' => [ 'ext.wikiEditor.dialogs', - ), - ), + ], + ], /* Labs Features */ - 'preview' => array( - 'preferences' => array( - 'wikieditor-preview' => array( + 'preview' => [ + 'preferences' => [ + 'wikieditor-preview' => [ 'type' => 'toggle', 'label-message' => 'wikieditor-preview-preference', 'section' => 'editing/labs', - ), - ), - 'requirements' => array( + ], + ], + 'requirements' => [ 'wikieditor-preview' => true, - ), - 'modules' => array( + ], + 'modules' => [ 'ext.wikiEditor.preview', - ), - ), - 'publish' => array( - 'preferences' => array( - 'wikieditor-publish' => array( + ], + ], + 'publish' => [ + 'preferences' => [ + 'wikieditor-publish' => [ 'type' => 'toggle', 'label-message' => 'wikieditor-publish-preference', 'section' => 'editing/labs', - ), - ), - 'requirements' => array( + ], + ], + 'requirements' => [ 'wikieditor-publish' => true, - ), - 'modules' => array( + ], + 'modules' => [ 'ext.wikiEditor.publish', - ), - ) - ); + ], + ] + ]; /* Static Methods */ @@ -133,7 +133,7 @@ class WikiEditorHooks { * @param array $data Data to log for this action * @return bool Whether the event was logged or not. */ - public static function doEventLogging( $action, $article, $data = array() ) { + public static function doEventLogging( $action, $article, $data = [] ) { global $wgVersion; if ( !class_exists( 'EventLogging' ) ) { return false; @@ -147,7 +147,7 @@ class WikiEditorHooks { $page = $article->getPage(); $title = $article->getTitle(); - $data = array( + $data = [ 'action' => $action, 'version' => 1, 'editor' => 'wikitext', @@ -160,7 +160,7 @@ class WikiEditorHooks { 'user.id' => $user->getId(), 'user.editCount' => $user->getEditCount() ?: 0, 'mediawiki.version' => $wgVersion - ) + $data; + ] + $data; if ( $user->isAnon() ) { $data['user.class'] = 'IP'; @@ -202,7 +202,7 @@ class WikiEditorHooks { // user just pressed 'Show preview' or 'Show changes', or switched from VE keeping // changes. if ( class_exists( 'EventLogging' ) && !$request->wasPosted() ) { - $data = array(); + $data = []; $data['editingSessionId'] = self::getEditingStatsId(); if ( $request->getVal( 'section' ) ) { $data['action.init.type'] = 'section'; @@ -248,12 +248,12 @@ class WikiEditorHooks { $outputPage->addHTML( Xml::element( 'input', - array( + [ 'type' => 'hidden', 'name' => 'editingStatsId', 'id' => 'editingStatsId', 'value' => $editingStatsId - ) + ] ) ); return true; @@ -270,9 +270,9 @@ class WikiEditorHooks { public static function EditPageBeforeEditToolbar( &$toolbar ) { if ( self::isEnabled( 'toolbar' ) ) { $toolbar = Html::rawElement( - 'div', array( + 'div', [ 'class' => 'wikiEditor-oldToolbar' - ), + ], $toolbar ); } @@ -326,12 +326,12 @@ class WikiEditorHooks { * @return bool */ public static function resourceLoaderTestModules( &$testModules, &$resourceLoader ) { - $testModules['qunit']['ext.wikiEditor.toolbar.test'] = array( - 'scripts' => array( 'tests/qunit/ext.wikiEditor.toolbar.test.js' ), - 'dependencies' => array( 'ext.wikiEditor.toolbar' ), + $testModules['qunit']['ext.wikiEditor.toolbar.test'] = [ + 'scripts' => [ 'tests/qunit/ext.wikiEditor.toolbar.test.js' ], + 'dependencies' => [ 'ext.wikiEditor.toolbar' ], 'localBasePath' => __DIR__, 'remoteExtPath' => 'WikiEditor', - ); + ]; return true; } @@ -344,7 +344,7 @@ class WikiEditorHooks { */ public static function makeGlobalVariablesScript( &$vars ) { // Build and export old-style wgWikiEditorEnabledModules object for back compat - $enabledModules = array(); + $enabledModules = []; foreach ( self::$features as $name => $feature ) { $enabledModules[$name] = self::isEnabled( $name ); } @@ -359,7 +359,7 @@ class WikiEditorHooks { * @return bool */ private static function getMagicWords( &$vars ) { - $requiredMagicWords = array( + $requiredMagicWords = [ 'redirect', 'img_right', 'img_left', @@ -368,15 +368,14 @@ class WikiEditorHooks { 'img_thumbnail', 'img_framed', 'img_frameless', - ); - $magicWords = array(); + ]; + $magicWords = []; foreach ( $requiredMagicWords as $name ) { $magicWords[$name] = MagicWord::get( $name )->getSynonym( 0 ); } $vars['wgWikiEditorMagicWords'] = $magicWords; } - /** * Gets a 32 character alphanumeric random string to be used for stats. * @return string @@ -402,7 +401,7 @@ class WikiEditorHooks { self::doEventLogging( 'saveAttempt', $article, - array( 'editingSessionId' => $request->getVal( 'editingStatsId' ) ) + [ 'editingSessionId' => $request->getVal( 'editingStatsId' ) ] ); } @@ -420,7 +419,7 @@ class WikiEditorHooks { $article = $editPage->getArticle(); $request = $article->getContext()->getRequest(); if ( $request->getVal( 'editingStatsId' ) ) { - $data = array(); + $data = []; $data['editingSessionId'] = $request->getVal( 'editingStatsId' ); if ( $status->isOK() ) { diff --git a/composer.json b/composer.json index 32781fec..71806c51 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "license": "GPL-2.0+", "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.5.1" + "mediawiki/mediawiki-codesniffer": "0.7.1" }, "scripts": { "test": [