Skip to content

Commit 92e97d6

Browse files
committed
revert usage of new array syntax []
See: 86c5bae Related-to: 930a860, 5d5089a Signed-off-by: William Desportes <williamdes@wdes.fr>
1 parent bb6a2b0 commit 92e97d6

File tree

12 files changed

+34
-30
lines changed

12 files changed

+34
-30
lines changed

src/Statements/InsertStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function parse(Parser $parser, TokensList $list)
195195
$this->into = IntoKeyword::parse(
196196
$parser,
197197
$list,
198-
['fromInsert' => true]
198+
array('fromInsert' => true)
199199
);
200200

201201
$state = 1;

src/Statements/LoadStatement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function parse(Parser $parser, TokensList $list)
281281
$this->file_name = Expression::parse(
282282
$parser,
283283
$list,
284-
['parseField' => 'file']
284+
array('parseField' => 'file')
285285
);
286286
$state = 1;
287287
} elseif ($state === 1) {
@@ -298,7 +298,7 @@ public function parse(Parser $parser, TokensList $list)
298298
&& $token->keyword === 'TABLE'
299299
) {
300300
++$list->idx;
301-
$this->table = Expression::parse($parser, $list, ['parseField' => 'table']);
301+
$this->table = Expression::parse($parser, $list, array('parseField' => 'table'));
302302
$state = 3;
303303
} else {
304304
$parser->error('Unexpected token.', $token);

src/Utils/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function runLint()
142142
if (isset($params['q'])) {
143143
$lexer = new Lexer($params['q'], false);
144144
$parser = new Parser($lexer->list);
145-
$errors = Error::get([$lexer, $parser]);
145+
$errors = Error::get(array($lexer, $parser));
146146
if (count($errors) === 0) {
147147
return 0;
148148
}

tests/Builder/CreateStatementTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ public function testBuilderTable()
9999
$stmt = new CreateStatement();
100100

101101
$stmt->name = new Expression('', 'test', '');
102-
$stmt->options = new OptionsArray(['TABLE']);
102+
$stmt->options = new OptionsArray(array('TABLE'));
103103
$stmt->fields = array(
104104
new CreateDefinition(
105105
'id',
106-
new OptionsArray(['NOT NULL', 'AUTO_INCREMENT']),
107-
new DataType('INT', array(11), new OptionsArray(['UNSIGNED']))
106+
new OptionsArray(array('NOT NULL', 'AUTO_INCREMENT')),
107+
new DataType('INT', array(11), new OptionsArray(array('UNSIGNED')))
108108
),
109109
new CreateDefinition(
110110
'',
111111
null,
112-
new Key('', array(['name' => 'id']), 'PRIMARY KEY')
112+
new Key('', array(array('name' => 'id')), 'PRIMARY KEY')
113113
)
114114
);
115115

@@ -289,9 +289,9 @@ public function testBuilderTrigger()
289289
{
290290
$stmt = new CreateStatement();
291291

292-
$stmt->options = new OptionsArray(['TRIGGER']);
292+
$stmt->options = new OptionsArray(array('TRIGGER'));
293293
$stmt->name = new Expression('ins_sum');
294-
$stmt->entityOptions = new OptionsArray(['BEFORE', 'INSERT']);
294+
$stmt->entityOptions = new OptionsArray(array('BEFORE', 'INSERT'));
295295
$stmt->table = new Expression('account');
296296
$stmt->body = 'SET @sum = @sum + NEW.amount';
297297

tests/Builder/StatementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function testBuilder()
1515
{
1616
$stmt = new SelectStatement();
1717

18-
$stmt->options = new OptionsArray(['DISTINCT']);
18+
$stmt->options = new OptionsArray(array('DISTINCT'));
1919

2020
$stmt->expr[] = new Expression('sakila', 'film', 'film_id', 'fid');
2121
$stmt->expr[] = new Expression('COUNT(film_id)');

tests/Components/FunctionCallTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testBuildArray()
1616

1717
public function testBuildArrayObj()
1818
{
19-
$component = new FunctionCall('func', new ArrayObj(['a', 'b']));
19+
$component = new FunctionCall('func', new ArrayObj(array('a', 'b')));
2020
$this->assertEquals('func(a, b)', FunctionCall::build($component));
2121
}
2222
}

tests/Components/OptionsArrayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testHas()
8181
public function testRemove()
8282
{
8383
/* Assertion 1 */
84-
$component = new OptionsArray(['a', 'b', 'c']);
84+
$component = new OptionsArray(array('a', 'b', 'c'));
8585
$this->assertTrue($component->remove('b'));
8686
$this->assertFalse($component->remove('d'));
8787
$this->assertEquals($component->options, array(0 => 'a', 2 => 'c'));
@@ -106,8 +106,8 @@ public function testRemove()
106106

107107
public function testMerge()
108108
{
109-
$component = new OptionsArray(['a']);
110-
$component->merge(['b', 'c']);
109+
$component = new OptionsArray(array('a'));
110+
$component->merge(array('b', 'c'));
111111
$this->assertEquals($component->options, array('a', 'b', 'c'));
112112
}
113113

tests/Lexer/ContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function testEscape()
143143
'`a`',
144144
'`b`',
145145
),
146-
Context::escape(['a', 'b'])
146+
Context::escape(array('a', 'b'))
147147
);
148148
}
149149
}

tests/Utils/CLITest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class CLITest extends TestCase
88
{
99
private function getCLI($getopt)
1010
{
11-
$cli = $this->getMockBuilder('PhpMyAdmin\SqlParser\Utils\CLI')->setMethods(['getopt'])->getMock();
11+
$cli = $this->getMockBuilder('PhpMyAdmin\SqlParser\Utils\CLI')->setMethods(array('getopt'))->getMock();
1212
$cli->method('getopt')->willReturn($getopt);
1313

1414
return $cli;
@@ -48,28 +48,28 @@ public function highlightParams()
4848
array(
4949
array('q' => 'SELECT 1'),
5050
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
51-
0,
51+
0
5252
),
5353
array(
5454
array('query' => 'SELECT 1'),
5555
"\x1b[35mSELECT\n \x1b[92m1\x1b[0m\n",
56-
0,
56+
0
5757
),
5858
array(
5959
array(
6060
'q' => 'SELECT /* comment */ 1 /* other */',
6161
'f' => 'text',
6262
),
6363
"SELECT\n /* comment */ 1 /* other */\n",
64-
0,
64+
0
6565
),
6666
array(
6767
array(
6868
'q' => 'SELECT 1',
6969
'f' => 'foo',
7070
),
7171
"ERROR: Invalid value for format!\n",
72-
1,
72+
1
7373
),
7474
array(
7575
array(
@@ -78,13 +78,13 @@ public function highlightParams()
7878
),
7979
'<span class="sql-reserved">SELECT</span>' . '<br/>' .
8080
'&nbsp;&nbsp;&nbsp;&nbsp;<span class="sql-number">1</span>' . "\n",
81-
0,
81+
0
8282
),
8383
array(
8484
array('h' => true),
8585
'Usage: highlight-query --query SQL [--format html|cli|text]' . "\n" .
8686
' cat file.sql | highlight-query' . "\n",
87-
0,
87+
0
8888
),
8989
array(
9090
array(),
@@ -96,7 +96,7 @@ public function highlightParams()
9696
array(
9797
false,
9898
'',
99-
1,
99+
1
100100
)
101101
);
102102
}
@@ -225,7 +225,11 @@ public function testStdinPipe($cmd, $result)
225225

226226
public function stdinParams()
227227
{
228-
$binPath = PHP_BINARY .' '. dirname(__DIR__,2 ). '/bin/';
228+
if (defined('PHP_BINARY')) {
229+
$binPath = PHP_BINARY . ' ' . dirname(__DIR__, 2) . '/bin/';
230+
} else {
231+
$binPath = 'php' . ' ' . realpath(dirname(__DIR__) . '/../') . '/bin/';
232+
}
229233

230234
return array(
231235
array('echo "SELECT 1" | '. $binPath .'highlight-query', 0),

tests/Utils/ErrorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ public function testGet()
2828
17,
2929
),
3030
),
31-
Error::get([$lexer, $parser])
31+
Error::get(array($lexer, $parser))
3232
);
3333
}
3434

3535
public function testFormat()
3636
{
3737
$this->assertEquals(
3838
array('#1: error msg (near "token" at position 100)'),
39-
Error::format([['error msg', 42, 'token', 100]])
39+
Error::format(array(array('error msg', 42, 'token', 100)))
4040
);
4141
}
4242
}

0 commit comments

Comments
 (0)