Skip to content

Commit

Permalink
use short array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot committed Mar 31, 2015
1 parent 584a0d8 commit 8fb9991
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Expand Up @@ -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']) === []
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/basics.php
Expand Up @@ -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})";
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Cache/Engine/MemcachedEngineTest.php
Expand Up @@ -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);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/TestCase/Error/DebuggerTest.php
Expand Up @@ -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();
Expand All @@ -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);
}

Expand All @@ -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();
Expand Down

0 comments on commit 8fb9991

Please sign in to comment.