Skip to content

Commit 8fb9991

Browse files
committed
use short array syntax
1 parent 584a0d8 commit 8fb9991

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/View/Helper/FormHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,7 @@ protected function _initInputField($field, $options = [])
23652365
$options['disabled'] === 'disabled' ||
23662366
(is_array($options['disabled']) &&
23672367
!empty($options['options']) &&
2368-
array_diff($options['options'], $options['disabled']) === array()
2368+
array_diff($options['options'], $options['disabled']) === []
23692369
)
23702370
);
23712371
}

src/basics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ function stackTrace(array $options = [])
131131
*/
132132
function json_last_error_msg()
133133
{
134-
static $errors = array(
134+
static $errors = [
135135
JSON_ERROR_NONE => '',
136136
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
137137
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
138138
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
139139
JSON_ERROR_SYNTAX => 'Syntax error',
140140
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
141-
);
141+
];
142142
$error = json_last_error();
143143
return array_key_exists($error, $errors) ? $errors[$error] : "Unknown error ({$error})";
144144
}

tests/TestCase/Cache/Engine/MemcachedEngineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function testParseServerStringWithU()
454454
{
455455
$Memcached = new TestMemcachedEngine();
456456
$result = $Memcached->parseServerString('udomain.net:13211');
457-
$this->assertEquals(array('udomain.net', '13211'), $result);
457+
$this->assertEquals(['udomain.net', '13211'], $result);
458458
}
459459

460460
/**

tests/TestCase/Error/DebuggerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,19 @@ public function testOutputAsException()
158158
*/
159159
public function testAddFormat()
160160
{
161-
Debugger::addFormat('js', array(
161+
Debugger::addFormat('js', [
162162
'traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' .
163163
'&line={:line}">{:path}</a>, line {:line}'
164-
));
164+
]);
165165
Debugger::outputAs('js');
166166

167167
$result = Debugger::trace();
168168
$this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result);
169169

170-
Debugger::addFormat('xml', array(
170+
Debugger::addFormat('xml', [
171171
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
172172
'{:description}</error>',
173-
));
173+
]);
174174
Debugger::outputAs('xml');
175175

176176
ob_start();
@@ -184,14 +184,14 @@ public function testAddFormat()
184184
]);
185185
$result = ob_get_clean();
186186

187-
$expected = array(
187+
$expected = [
188188
'<error',
189189
'<code', '8', '/code',
190190
'<file', 'preg:/[^<]+/', '/file',
191191
'<line', '' . ((int)__LINE__ - 9), '/line',
192192
'preg:/Undefined variable:\s+foo/',
193193
'/error'
194-
);
194+
];
195195
$this->assertHtml($expected, $result, true);
196196
}
197197

@@ -202,7 +202,7 @@ public function testAddFormat()
202202
*/
203203
public function testAddFormatCallback()
204204
{
205-
Debugger::addFormat('callback', array('callback' => array($this, 'customFormat')));
205+
Debugger::addFormat('callback', ['callback' => [$this, 'customFormat']]);
206206
Debugger::outputAs('callback');
207207

208208
ob_start();

0 commit comments

Comments
 (0)