mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Use array() instead of the short notation []
This commit is contained in:
parent
f23e6589d0
commit
b89d8d5efa
2 changed files with 5 additions and 5 deletions
|
@ -1317,7 +1317,7 @@ class HashTest extends CakeTestCase {
|
||||||
array('Item' => array('image' => 'Img10.jpg')),
|
array('Item' => array('image' => 'Img10.jpg')),
|
||||||
array('Item' => array('image' => 'img2.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(
|
$expected = array(
|
||||||
array('Item' => array('image' => 'img99.jpg')),
|
array('Item' => array('image' => 'img99.jpg')),
|
||||||
array('Item' => array('image' => 'Img12.jpg')),
|
array('Item' => array('image' => 'Img12.jpg')),
|
||||||
|
@ -1327,7 +1327,7 @@ class HashTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $result);
|
$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(
|
$expected = array(
|
||||||
array('Item' => array('image' => 'img1.jpg')),
|
array('Item' => array('image' => 'img1.jpg')),
|
||||||
array('Item' => array('image' => 'img2.jpg')),
|
array('Item' => array('image' => 'img2.jpg')),
|
||||||
|
@ -1436,7 +1436,7 @@ class HashTest extends CakeTestCase {
|
||||||
array('Item' => array('name' => 'Baz')),
|
array('Item' => array('name' => 'Baz')),
|
||||||
array('Item' => array('name' => 'bat')),
|
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(
|
$expected = array(
|
||||||
array('Item' => array('name' => 'Baby')),
|
array('Item' => array('name' => 'Baby')),
|
||||||
array('Item' => array('name' => 'bar')),
|
array('Item' => array('name' => 'bar')),
|
||||||
|
@ -1458,7 +1458,7 @@ class HashTest extends CakeTestCase {
|
||||||
array('Item' => array('name' => 'Baz')),
|
array('Item' => array('name' => 'Baz')),
|
||||||
array('Item' => array('name' => 'bat')),
|
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(
|
$expected = array(
|
||||||
array('Item' => array('name' => 'Baby')),
|
array('Item' => array('name' => 'Baby')),
|
||||||
array('Item' => array('name' => 'bar')),
|
array('Item' => array('name' => 'bar')),
|
||||||
|
|
|
@ -839,7 +839,7 @@ class Hash {
|
||||||
* - `natural` Compare items as strings using "natural ordering" in a human friendly way.
|
* - `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'
|
* 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:
|
* 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 array $data An array of data to sort
|
||||||
* @param string $path A Set-compatible path to the array value
|
* @param string $path A Set-compatible path to the array value
|
||||||
|
|
Loading…
Reference in a new issue