mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
[BaseCollection] Treat the null index as "no index" only while adding new element, iow. do not treat empty string as "no index" behaviour
This commit is contained in:
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
|
# 1.1.1
|
||||||
|
|
||||||
|
1. [BaseCollection] Treat the `null` index as "no index" only while adding new element, iow. do not treat empty
|
||||||
|
string as "no index" behaviour.
|
||||||
|
|
||||||
# 1.1.0
|
# 1.1.0
|
||||||
|
|
||||||
1. Rename Meritoo\Common\Collection\Collection class to Meritoo\Common\Collection\BaseCollection.
|
1. Rename Meritoo\Common\Collection\Collection class to Meritoo\Common\Collection\BaseCollection.
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ trait AddTrait
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $index || '' === $index) {
|
if (null === $index) {
|
||||||
$this->elements[] = $element;
|
$this->elements[] = $element;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ class BaseCollectionTest extends BaseTestCase
|
|||||||
'This is test 4',
|
'This is test 4',
|
||||||
'',
|
'',
|
||||||
4,
|
4,
|
||||||
1,
|
'',
|
||||||
new StringCollection([
|
new StringCollection([
|
||||||
'test1' => 'I am 1st',
|
'test1' => 'I am 1st',
|
||||||
'test2' => 'I am 2nd',
|
'test2' => 'I am 2nd',
|
||||||
|
|||||||
Reference in New Issue
Block a user