@@ -52,8 +52,8 @@ discard block |
||
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 |
||
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 |
||
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 ]; |
@@ -75,8 +75,8 @@ discard block |
||
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 |
||
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 |
||
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, |
@@ -41,7 +41,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @ingroup Extensions |
7 | 7 | */ |
8 | 8 | |
9 | -$magicWords = []; |
|
9 | +$magicWords = [ ]; |
|
10 | 10 | |
11 | 11 | /** English (English) */ |
12 | 12 | $magicWords[ 'en' ] = [ |
@@ -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( '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 |
||
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 ) { |
@@ -68,11 +68,11 @@ |
||
68 | 68 | return $directory; |
69 | 69 | } |
70 | 70 | |
71 | -$extDirectory = dirname ( getDirectory() ); |
|
71 | +$extDirectory = dirname( getDirectory() ); |
|
72 | 72 | |
73 | 73 | $config = isReadablePath( "$extDirectory/phpunit.xml.dist" ); |
74 | 74 | $mw = isReadablePath( dirname( dirname( $extDirectory ) ) . "/tests/phpunit/phpunit.php" ); |
75 | 75 | |
76 | -echo "php {$mw} -c {$config} " . implode( ' ', addArguments( $GLOBALS['argv'] ) ) . "\n\n"; |
|
76 | +echo "php {$mw} -c {$config} " . implode( ' ', addArguments( $GLOBALS[ 'argv' ] ) ) . "\n\n"; |
|
77 | 77 | |
78 | -passthru( "php {$mw} -c {$config} " . implode( ' ', addArguments( $GLOBALS['argv'] ) ) ); |
|
78 | +passthru( "php {$mw} -c {$config} " . implode( ' ', addArguments( $GLOBALS[ 'argv' ] ) ) ); |
@@ -78,10 +78,10 @@ |
||
78 | 78 | protected function loadXmlFiles( $path ) { |
79 | 79 | |
80 | 80 | $directoryIterator = new \RecursiveDirectoryIterator( $path ); |
81 | - $iteratorIterator = new \RecursiveIteratorIterator($directoryIterator); |
|
82 | - $regexIterator = new \RegexIterator($iteratorIterator, '/^.+\.xml$/i', \RecursiveRegexIterator::GET_MATCH); |
|
81 | + $iteratorIterator = new \RecursiveIteratorIterator( $directoryIterator ); |
|
82 | + $regexIterator = new \RegexIterator( $iteratorIterator, '/^.+\.xml$/i', \RecursiveRegexIterator::GET_MATCH ); |
|
83 | 83 | |
84 | - $files = call_user_func_array('array_merge', iterator_to_array( $regexIterator ) ); |
|
84 | + $files = call_user_func_array( 'array_merge', iterator_to_array( $regexIterator ) ); |
|
85 | 85 | |
86 | 86 | return $files; |
87 | 87 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function provideData() { |
96 | 96 | |
97 | - $data = []; |
|
97 | + $data = [ ]; |
|
98 | 98 | |
99 | 99 | $xmlFileProvider = new XmlFileProvider( __DIR__ . '/../Fixture/articleAnnotation' ); |
100 | 100 | $files = $xmlFileProvider->getFiles(); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $testCase = [ |
112 | 112 | 0 => substr( $file, strlen( __DIR__ . '/../Fixture/articleAnnotation' ) ), |
113 | 113 | 1 => trim( $decoded[ 'text' ] ), |
114 | - 2 => [], |
|
114 | + 2 => [ ], |
|
115 | 115 | 3 => trim( $decoded[ 'expected' ] ) . "\n", |
116 | 116 | ]; |
117 | 117 | |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | foreach ( $decoded[ 'glossary-entry' ] as $entry ) { |
123 | - $testCase[ 2 ][] = [ $entry[ 'term' ], $entry[ 'definition' ], $entry[ 'link' ], $entry[ 'style' ] ]; |
|
123 | + $testCase[ 2 ][ ] = [ $entry[ 'term' ], $entry[ 'definition' ], $entry[ 'link' ], $entry[ 'style' ] ]; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | \MediaWiki\restoreWarnings(); |
127 | 127 | |
128 | - $data[] = $testCase; |
|
128 | + $data[ ] = $testCase; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $data; |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class LingoI18NTest extends \PHPUnit\Framework\TestCase { |
38 | 38 | |
39 | - public function testJsonSchemaValidatorExists(){ |
|
39 | + public function testJsonSchemaValidatorExists() { |
|
40 | 40 | $this->assertTrue( class_exists( '\JsonSchema\Validator' ) ); |
41 | - $this->assertTrue( method_exists('\JsonSchema\Validator', 'check' ) ); |
|
41 | + $this->assertTrue( method_exists( '\JsonSchema\Validator', 'check' ) ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function testMagicWordsLoaded() { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | // format error message |
62 | 62 | $errors = implode( '', array_map( |
63 | - function ( $error ) { |
|
63 | + function( $error ) { |
|
64 | 64 | return "* [{$error[ 'property' ]}] {$error[ 'message' ]}\n"; |
65 | 65 | }, |
66 | 66 | $validator->getErrors() |