@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param String $definition |
86 | 86 | * @return Array the tree node the element was stored in |
87 | 87 | */ |
88 | - protected function &addElement( Array &$path, &$term, &$definition ) { |
|
88 | + protected function &addElement( array &$path, &$term, &$definition ) { |
|
89 | 89 | |
90 | 90 | $tree = &$this->mTree; |
91 | 91 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - public function findNextTermNoSkip( Array &$tree, &$lexemes, $index, $countLexemes ) { |
|
145 | + public function findNextTermNoSkip( array &$tree, &$lexemes, $index, $countLexemes ) { |
|
146 | 146 | |
147 | 147 | if ( $index + 1 < $countLexemes && array_key_exists( $currLex = $lexemes[ $index + 1 ][ 0 ], $tree ) ) { |
148 | 148 | $ret = $this->findNextTermNoSkip( $tree[ $currLex ], $lexemes, $index + 1, $countLexemes ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $severity |
54 | 54 | */ |
55 | 55 | public function addMessage( $message, $severity = self::MESSAGE_NOTICE ) { |
56 | - $this->mMessages[] = array( $message, $severity ); |
|
56 | + $this->mMessages[ ] = array( $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 |
||
67 | 67 | * @param $message |
68 | 68 | */ |
69 | 69 | public function addError( $message ) { |
70 | - $this->mMessages[] = array( $message, self::MESSAGE_ERROR ); |
|
70 | + $this->mMessages[ ] = array( $message, self::MESSAGE_ERROR ); |
|
71 | 71 | wfDebug( "Error: $message\n" ); |
72 | 72 | } |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param $message |
76 | 76 | */ |
77 | 77 | public function addWarning( $message ) { |
78 | - $this->mMessages[] = array( $message, self::MESSAGE_WARNING ); |
|
78 | + $this->mMessages[ ] = array( $message, self::MESSAGE_WARNING ); |
|
79 | 79 | wfDebug( "Warning: $message\n" ); |
80 | 80 | } |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param $message |
84 | 84 | */ |
85 | 85 | public function addNotice( $message ) { |
86 | - $this->mMessages[] = array( $message, self::MESSAGE_NOTICE ); |
|
86 | + $this->mMessages[ ] = array( $message, self::MESSAGE_NOTICE ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -70,7 +70,7 @@ |
||
70 | 70 | * @param $key |
71 | 71 | * @return bool |
72 | 72 | */ |
73 | - public function isStashed ( $key ) { |
|
73 | + public function isStashed( $key ) { |
|
74 | 74 | return isset( $this->mStash[ $key ] ); |
75 | 75 | } |
76 | 76 |
@@ -128,8 +128,8 @@ |
||
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 ) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $term = null; |
117 | 117 | } |
118 | 118 | |
119 | - $definitions[] = trim( $chunks[ 1 ] ); |
|
119 | + $definitions[ ] = trim( $chunks[ 1 ] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // found a new term? |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $ret = array(); |
137 | 137 | |
138 | 138 | foreach ( $definitions as $definition ) { |
139 | - $ret[] = array( |
|
139 | + $ret[ ] = array( |
|
140 | 140 | Element::ELEMENT_TERM => $term, |
141 | 141 | Element::ELEMENT_DEFINITION => $definition, |
142 | 142 | Element::ELEMENT_LINK => null, |
@@ -58,8 +58,8 @@ |
||
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Lingo\Element constructor. |
61 | - * @param $term |
|
62 | - * @param $definition |
|
61 | + * @param string $term |
|
62 | + * @param string $definition |
|
63 | 63 | */ |
64 | 64 | public function __construct( &$term, &$definition = null ) { |
65 | 65 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | const ELEMENT_LINK = 3; |
48 | 48 | const ELEMENT_STYLE = 4; |
49 | 49 | |
50 | - const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
50 | + const ELEMENT_FIELDCOUNT = 5; // number of fields stored for each element; (last field's index) + 1 |
|
51 | 51 | |
52 | 52 | const LINK_TEMPLATE_ID = 'LingoLink'; |
53 | 53 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param $definition |
75 | 75 | */ |
76 | 76 | public function addDefinition( &$definition ) { |
77 | - $this->mDefinitions[] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
77 | + $this->mDefinitions[ ] = array_pad( $definition, self::ELEMENT_FIELDCOUNT, null ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | $classes = array(); |
169 | 169 | |
170 | 170 | if ( $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ] !== null ) { |
171 | - $classes[] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
171 | + $classes[ ] = $this->mDefinitions[ 0 ][ self::ELEMENT_STYLE ]; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | if ( !$target->isKnown() ) { |
175 | - $classes[] = 'new'; |
|
175 | + $classes[ ] = 'new'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if ( $target->isExternal() ) { |
179 | - $classes[] = 'extiw'; |
|
179 | + $classes[ ] = 'extiw'; |
|
180 | 180 | } |
181 | 181 | |
182 | - if ( count($classes) > 0 ) { |
|
183 | - $link->setAttribute( 'class', join(' ', $classes ) ); |
|
182 | + if ( count( $classes ) > 0 ) { |
|
183 | + $link->setAttribute( 'class', join( ' ', $classes ) ); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return $link; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | protected function getFullDefinitionAsTooltip( StashingDOMDocument &$doc, callable $callback = null ) { |
214 | 214 | |
215 | 215 | if ( $callback === null ) { |
216 | - $callback = function( $text ){ return htmlentities( $text, ENT_COMPAT, 'UTF-8' ); }; |
|
216 | + $callback = function( $text ) { return htmlentities( $text, ENT_COMPAT, 'UTF-8' ); }; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | // Wrap term and definition in <span> tags |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if ( $mLinkTemplate === null ) { |
276 | 276 | |
277 | 277 | $mLinkTemplate = $doc->createElement( 'a' ); |
278 | - $mLinkTemplate->setAttribute( 'class', 'mw-lingo-tooltip-link'); |
|
278 | + $mLinkTemplate->setAttribute( 'class', 'mw-lingo-tooltip-link' ); |
|
279 | 279 | |
280 | 280 | $doc->stashSet( $mLinkTemplate, self::LINK_TEMPLATE_ID ); |
281 | 281 | } |
@@ -43,7 +43,7 @@ discard block |
||
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 |
||
53 | 53 | |
54 | 54 | \Hooks::register( 'ParserAfterParse', array( $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 |
||
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 ) { |
@@ -160,7 +160,7 @@ discard block |
||
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 |
||
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 | } |