Use array() instead of the short notation []

This commit is contained in:
Adrian Gunawan 2015-08-14 14:15:00 +10:00
parent f23e6589d0
commit b89d8d5efa
2 changed files with 5 additions and 5 deletions

View file

@ -1317,7 +1317,7 @@ class HashTest extends CakeTestCase {
array('Item' => array('image' => 'Img10.jpg')),
array('Item' => array('image' => 'img2.jpg')),
);
$result = Hash::sort($items, '{n}.Item.image', 'desc', ['type' => 'natural', 'ignoreCase' => true]);
$result = Hash::sort($items, '{n}.Item.image', 'desc', array('type' => 'natural', 'ignoreCase' => true));
$expected = array(
array('Item' => array('image' => 'img99.jpg')),
array('Item' => array('image' => 'Img12.jpg')),
@ -1327,7 +1327,7 @@ class HashTest extends CakeTestCase {
);
$this->assertEquals($expected, $result);
$result = Hash::sort($items, '{n}.Item.image', 'asc', ['type' => 'natural', 'ignoreCase' => true]);
$result = Hash::sort($items, '{n}.Item.image', 'asc', array('type' => 'natural', 'ignoreCase' => true));
$expected = array(
array('Item' => array('image' => 'img1.jpg')),
array('Item' => array('image' => 'img2.jpg')),
@ -1436,7 +1436,7 @@ class HashTest extends CakeTestCase {
array('Item' => array('name' => 'Baz')),
array('Item' => array('name' => 'bat')),
);
$sorted = Hash::sort($toSort, '{n}.Item.name', 'asc', ['type' => 'string', 'ignoreCase' => true]);
$sorted = Hash::sort($toSort, '{n}.Item.name', 'asc', array('type' => 'string', 'ignoreCase' => true));
$expected = array(
array('Item' => array('name' => 'Baby')),
array('Item' => array('name' => 'bar')),
@ -1458,7 +1458,7 @@ class HashTest extends CakeTestCase {
array('Item' => array('name' => 'Baz')),
array('Item' => array('name' => 'bat')),
);
$sorted = Hash::sort($toSort, '{n}.Item.name', 'asc', ['type' => 'regular', 'ignoreCase' => true]);
$sorted = Hash::sort($toSort, '{n}.Item.name', 'asc', array('type' => 'regular', 'ignoreCase' => true));
$expected = array(
array('Item' => array('name' => 'Baby')),
array('Item' => array('name' => 'bar')),

View file

@ -839,7 +839,7 @@ class Hash {
* - `natural` Compare items as strings using "natural ordering" in a human friendly way.
* Will sort foo10 below foo2 as an example. Requires PHP 5.4 or greater or it will fallback to 'regular'
* To do case insensitive sorting, pass the type as an array as follows:
* ['type' => 'regular', 'ignoreCase' => true]
* array('type' => 'regular', 'ignoreCase' => true)
*
* @param array $data An array of data to sort
* @param string $path A Set-compatible path to the array value