Completed
Push — master ( c48858...841b7d )
by
unknown
33:26
created
src/BasicBackend.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,8 +128,8 @@
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	/**
131
-	 * @param $definitions
132
-	 * @param $term
131
+	 * @param string[] $definitions
132
+	 * @param string $term
133 133
 	 * @return array
134 134
 	 */
135 135
 	protected function queueDefinitions( $definitions, $term ) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	public function next() {
76 76
 
77 77
 		static $term = null;
78
-		static $definitions = [];
79
-		static $ret = [];
78
+		static $definitions = [ ];
79
+		static $ret = [ ];
80 80
 
81 81
 		$this->collectDictionaryLines();
82 82
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 
114 114
 			// wipe the data if it's a totally new term definition
115 115
 			if ( !empty( $term ) && count( $definitions ) > 0 ) {
116
-				$definitions = [];
116
+				$definitions = [ ];
117 117
 				$term = null;
118 118
 			}
119 119
 
120
-			$definitions[] = trim( $chunks[ 1 ] );
120
+			$definitions[ ] = trim( $chunks[ 1 ] );
121 121
 		}
122 122
 
123 123
 		// found a new term?
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	 * @return array
135 135
 	 */
136 136
 	protected function queueDefinitions( $definitions, $term ) {
137
-		$ret = [];
137
+		$ret = [ ];
138 138
 
139 139
 		foreach ( $definitions as $definition ) {
140
-			$ret[] = [
140
+			$ret[ ] = [
141 141
 				Element::ELEMENT_TERM       => $term,
142 142
 				Element::ELEMENT_DEFINITION => $definition,
143 143
 				Element::ELEMENT_LINK       => null,
Please login to merge, or discard this patch.
src/Element.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 	/**
64 64
 	 * Lingo\Element constructor.
65 65
 	 *
66
-	 * @param $term
66
+	 * @param string $term
67 67
 	 * @param $definition
68 68
 	 */
69 69
 	public function __construct( &$term, &$definition = null ) {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 	const ELEMENT_LINK = 3;
49 49
 	const ELEMENT_STYLE = 4;
50 50
 
51
-	const ELEMENT_FIELDCOUNT = 5;  // number of fields stored for each element; (last field's index) + 1
51
+	const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1
52 52
 
53 53
 	const LINK_TEMPLATE_ID = 'LingoLink';
54 54
 
55 55
 	private $formattedTerm = null;
56 56
 	private $formattedDefinitions = null;
57 57
 
58
-	private $mDefinitions = [];
58
+	private $mDefinitions = [ ];
59 59
 	private $mTerm = null;
60 60
 
61 61
 	private $hasBeenDisplayed = false;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @param array $definition
80 80
 	 */
81 81
 	public function addDefinition( &$definition ) {
82
-		$this->mDefinitions[] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null );
82
+		$this->mDefinitions[ ] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null );
83 83
 	}
84 84
 
85 85
 	/**
@@ -185,18 +185,18 @@  discard block
 block discarded – undo
185 185
 		// part here.
186 186
 
187 187
 		// set style
188
-		$classes = [];
188
+		$classes = [ ];
189 189
 
190 190
 		if ( $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] !== null ) {
191
-			$classes[] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ];
191
+			$classes[ ] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ];
192 192
 		}
193 193
 
194 194
 		if ( !$target->isKnown() ) {
195
-			$classes[] = 'new';
195
+			$classes[ ] = 'new';
196 196
 		}
197 197
 
198 198
 		if ( $target->isExternal() ) {
199
-			$classes[] = 'extiw';
199
+			$classes[ ] = 'extiw';
200 200
 		}
201 201
 
202 202
 		if ( count( $classes ) > 0 ) {
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 	protected function buildFormattedDefinitions() {
244 244
 
245 245
 		// Wrap definition in a <div> tag
246
-		$divDefinitions = [];
247
-		$divDefinitions[] = '<div class="mw-lingo-tooltip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . '" id="' . $this->getId() . '" >';
246
+		$divDefinitions = [ ];
247
+		$divDefinitions[ ] = '<div class="mw-lingo-tooltip ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . '" id="' . $this->getId() . '" >';
248 248
 
249 249
 		foreach ( $this->mDefinitions as $definition ) {
250 250
 
251
-			$divDefinitions[] = '<div class="mw-lingo-definition">';
251
+			$divDefinitions[ ] = '<div class="mw-lingo-definition">';
252 252
 
253
-			$divDefinitions[] = '<div class="mw-lingo-definition-text ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . "\">\n";
254
-			$divDefinitions[] = $definition[ self::ELEMENT_DEFINITION ];
255
-			$divDefinitions[] = "\n" . '</div>';
253
+			$divDefinitions[ ] = '<div class="mw-lingo-definition-text ' . $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] . "\">\n";
254
+			$divDefinitions[ ] = $definition[ self::ELEMENT_DEFINITION ];
255
+			$divDefinitions[ ] = "\n" . '</div>';
256 256
 
257 257
 			if ( $definition[ self::ELEMENT_LINK ] ) {
258 258
 
@@ -263,14 +263,14 @@  discard block
 block discarded – undo
263 263
 				}
264 264
 
265 265
 				if ( $url !== null ) {
266
-					$divDefinitions[] = '<div class="mw-lingo-definition-link">[' . $url . ' <nowiki/>]</div>';
266
+					$divDefinitions[ ] = '<div class="mw-lingo-definition-link">[' . $url . ' <nowiki/>]</div>';
267 267
 				}
268 268
 			}
269 269
 
270
-			$divDefinitions[] = '</div>';
270
+			$divDefinitions[ ] = '</div>';
271 271
 		}
272 272
 
273
-		$divDefinitions[] = "\n" . '</div>';
273
+		$divDefinitions[ ] = "\n" . '</div>';
274 274
 
275 275
 		$this->formattedDefinitions = join( $divDefinitions );
276 276
 	}
Please login to merge, or discard this patch.
src/Tree.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	const TREE_VERSION = 2;
54 54
 
55
-	private $mTree = [];
56
-	private $mList = [];
55
+	private $mTree = [ ];
56
+	private $mList = [ ];
57 57
 	private $mMinLength = 1000;
58 58
 
59 59
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			$this->mList[ $term ]->addDefinition( $definition );
72 72
 		} else {
73 73
 
74
-			$matches = [];
74
+			$matches = [ ];
75 75
 			preg_match_all( LingoParser::getInstance()->regex, $term, $matches );
76 76
 
77 77
 			$element = $this->addElement( $matches[ 0 ], $term, $definition );
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		while ( ( $step = array_shift( $path ) ) !== null ) {
98 98
 
99 99
 			if ( !isset( $tree[ $step ] ) ) {
100
-				$tree[ $step ] = [];
100
+				$tree[ $step ] = [ ];
101 101
 			}
102 102
 
103 103
 			$tree = &$tree[ $step ];
Please login to merge, or discard this patch.
src/MessageLog.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  */
42 42
 class MessageLog {
43 43
 
44
-	private $mMessages = [];
44
+	private $mMessages = [ ];
45 45
 	private $mParser = null;
46 46
 
47 47
 	const MESSAGE_ERROR = 1;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param int $severity
54 54
 	 */
55 55
 	public function addMessage( $message, $severity = self::MESSAGE_NOTICE ) {
56
-		$this->mMessages[] = [ $message, $severity ];
56
+		$this->mMessages[ ] = [ $message, $severity ];
57 57
 
58 58
 		// log errors and warnings in debug log
59 59
 		if ( $severity == self::MESSAGE_WARNING ||
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param $message
68 68
 	 */
69 69
 	public function addError( $message ) {
70
-		$this->mMessages[] = [ $message, self::MESSAGE_ERROR ];
70
+		$this->mMessages[ ] = [ $message, self::MESSAGE_ERROR ];
71 71
 		wfDebug( "Error: $message\n" );
72 72
 	}
73 73
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param $message
76 76
 	 */
77 77
 	public function addWarning( $message ) {
78
-		$this->mMessages[] = [ $message, self::MESSAGE_WARNING ];
78
+		$this->mMessages[ ] = [ $message, self::MESSAGE_WARNING ];
79 79
 		wfDebug( "Warning: $message\n" );
80 80
 	}
81 81
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param $message
84 84
 	 */
85 85
 	public function addNotice( $message ) {
86
-		$this->mMessages[] = [ $message, self::MESSAGE_NOTICE ];
86
+		$this->mMessages[ ] = [ $message, self::MESSAGE_NOTICE ];
87 87
 	}
88 88
 
89 89
 	/**
Please login to merge, or discard this patch.
src/Lingo.i18n.magic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @ingroup Extensions
7 7
  */
8 8
 
9
-$magicWords = [];
9
+$magicWords = [ ];
10 10
 
11 11
 /** English (English) */
12 12
 $magicWords[ 'en' ] = [
Please login to merge, or discard this patch.
src/LingoParser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				} else {
161 161
 
162 162
 					wfDebug( "Cache miss: Lingo tree not found in cache.\n" );
163
-					$this->mLingoTree =& $this->buildLingo();
163
+					$this->mLingoTree = & $this->buildLingo();
164 164
 					wfDebug( "Cached lingo tree.\n" );
165 165
 				}
166 166
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 			} else {
173 173
 				wfDebug( "Caching of lingo tree disabled.\n" );
174
-				$this->mLingoTree =& $this->buildLingo();
174
+				$this->mLingoTree = & $this->buildLingo();
175 175
 			}
176 176
 
177 177
 		}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		// Iterate all HTML text matches
237 237
 		$numberOfTextElements = $textElements->length;
238 238
 
239
-		$definitions = [];
239
+		$definitions = [ ];
240 240
 
241 241
 		for ( $textElementIndex = 0; $textElementIndex < $numberOfTextElements; $textElementIndex++ ) {
242 242
 			$textElement = $textElements->item( $textElementIndex );
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				continue;
246 246
 			}
247 247
 
248
-			$matches = [];
248
+			$matches = [ ];
249 249
 			preg_match_all(
250 250
 				$this->regex,
251 251
 				$textElement->nodeValue,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 				continue;
258 258
 			}
259 259
 
260
-			$wordDescriptors = &$matches[ 0 ];  // See __construct() for definition of "word"
260
+			$wordDescriptors = &$matches[ 0 ]; // See __construct() for definition of "word"
261 261
 			$numberOfWordDescriptors = count( $wordDescriptors );
262 262
 
263 263
 			$parentNode = &$textElement->parentNode;
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 
276 276
 					if ( $skippedWords > 0 ) { // skipped some text, insert it as is
277 277
 
278
-						$start = $wordDescriptors[$wordDescriptorIndex][self::WORD_OFFSET];
279
-						$length = $wordDescriptors[$wordDescriptorIndex + $skippedWords][self::WORD_OFFSET] - $start;
278
+						$start = $wordDescriptors[ $wordDescriptorIndex ][ self::WORD_OFFSET ];
279
+						$length = $wordDescriptors[ $wordDescriptorIndex + $skippedWords ][ self::WORD_OFFSET ] - $start;
280 280
 
281 281
 						$parentNode->insertBefore(
282 282
 							$doc->createTextNode(
283
-								substr( $textElement->nodeValue, $start, $length)
283
+								substr( $textElement->nodeValue, $start, $length )
284 284
 							),
285 285
 							$textElement
286 286
 						);
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 					// Only change element if found term before
302 302
 					if ( $changedElem === true ) {
303 303
 
304
-						$start = $wordDescriptors[$wordDescriptorIndex][self::WORD_OFFSET];
304
+						$start = $wordDescriptors[ $wordDescriptorIndex ][ self::WORD_OFFSET ];
305 305
 
306 306
 						$parentNode->insertBefore(
307 307
 							$doc->createTextNode(
308
-								substr( $textElement->nodeValue, $start)
308
+								substr( $textElement->nodeValue, $start )
309 309
 							),
310 310
 							$textElement
311 311
 						);
Please login to merge, or discard this patch.
src/Lingo.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public static function initExtension() {
45 45
 
46
-		$GLOBALS[ 'wgExtensionFunctions' ][] = function () {
46
+		$GLOBALS[ 'wgExtensionFunctions' ][ ] = function() {
47 47
 
48 48
 			$parser = LingoParser::getInstance();
49 49
 
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 
54 54
 			\Hooks::register( 'ContentAlterParserOutput', [ $parser, 'parse' ] );
55 55
 
56
-			\Hooks::register('GetDoubleUnderscoreIDs', function ( array &$doubleUnderscoreIDs ) {
57
-				$doubleUnderscoreIDs[] = 'noglossary';
56
+			\Hooks::register( 'GetDoubleUnderscoreIDs', function( array &$doubleUnderscoreIDs ) {
57
+				$doubleUnderscoreIDs[ ] = 'noglossary';
58 58
 				return true;
59 59
 			} );
60 60
 
61
-			\Hooks::register( 'ParserFirstCallInit', function ( \Parser $parser ) {
61
+			\Hooks::register( 'ParserFirstCallInit', function( \Parser $parser ) {
62 62
 
63
-				$parser->setHook( 'noglossary', function ( $input, array $args, \Parser $parser, \PPFrame $frame ) {
63
+				$parser->setHook( 'noglossary', function( $input, array $args, \Parser $parser, \PPFrame $frame ) {
64 64
 					$output = $parser->recursiveTagParse( $input, $frame );
65 65
 					return '<span class="noglossary">' . $output . '</span>';
66 66
 				} );
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				return true;
69 69
 			} );
70 70
 
71
-			\Hooks::register( 'SpecialPageBeforeExecute', function ( \SpecialPage $specialPage, $subPage ) {
71
+			\Hooks::register( 'SpecialPageBeforeExecute', function( \SpecialPage $specialPage, $subPage ) {
72 72
 
73 73
 				if ( $specialPage instanceof \SpecialVersion ) {
74 74
 					foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) {
Please login to merge, or discard this patch.