Skip to content
Permalink
Browse files

use short array syntax

  • Loading branch information...
antograssiot committed Mar 31, 2015
1 parent 584a0d8 commit 8fb9991bf9a9a2b1dc857fa4c44fedef82742d16
@@ -2365,7 +2365,7 @@ protected function _initInputField($field, $options = [])
$options['disabled'] === 'disabled' ||
(is_array($options['disabled']) &&
!empty($options['options']) &&
array_diff($options['options'], $options['disabled']) === array()
array_diff($options['options'], $options['disabled']) === []
)
);
}
@@ -131,14 +131,14 @@ function stackTrace(array $options = [])
*/
function json_last_error_msg()
{
static $errors = array(
static $errors = [
JSON_ERROR_NONE => '',
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
);
];
$error = json_last_error();
return array_key_exists($error, $errors) ? $errors[$error] : "Unknown error ({$error})";
}
@@ -454,7 +454,7 @@ public function testParseServerStringWithU()
{
$Memcached = new TestMemcachedEngine();
$result = $Memcached->parseServerString('udomain.net:13211');
$this->assertEquals(array('udomain.net', '13211'), $result);
$this->assertEquals(['udomain.net', '13211'], $result);
}
/**
@@ -158,19 +158,19 @@ public function testOutputAsException()
*/
public function testAddFormat()
{
Debugger::addFormat('js', array(
Debugger::addFormat('js', [
'traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' .
'&line={:line}">{:path}</a>, line {:line}'
));
]);
Debugger::outputAs('js');
$result = Debugger::trace();
$this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result);
Debugger::addFormat('xml', array(
Debugger::addFormat('xml', [
'error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' .
'{:description}</error>',
));
]);
Debugger::outputAs('xml');
ob_start();
@@ -184,14 +184,14 @@ public function testAddFormat()
]);
$result = ob_get_clean();
$expected = array(
$expected = [
'<error',
'<code', '8', '/code',
'<file', 'preg:/[^<]+/', '/file',
'<line', '' . ((int)__LINE__ - 9), '/line',
'preg:/Undefined variable:\s+foo/',
'/error'
);
];
$this->assertHtml($expected, $result, true);
}
@@ -202,7 +202,7 @@ public function testAddFormat()
*/
public function testAddFormatCallback()
{
Debugger::addFormat('callback', array('callback' => array($this, 'customFormat')));
Debugger::addFormat('callback', ['callback' => [$this, 'customFormat']]);
Debugger::outputAs('callback');
ob_start();

0 comments on commit 8fb9991

Please sign in to comment.
You can’t perform that action at this time.