mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +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.
|
||||
|
||||
# 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. Rename Meritoo\Common\Collection\Collection class to Meritoo\Common\Collection\BaseCollection.
|
||||
|
||||
@@ -30,7 +30,7 @@ trait AddTrait
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $index || '' === $index) {
|
||||
if (null === $index) {
|
||||
$this->elements[] = $element;
|
||||
|
||||
return;
|
||||
|
||||
@@ -438,7 +438,7 @@ class BaseCollectionTest extends BaseTestCase
|
||||
'This is test 4',
|
||||
'',
|
||||
4,
|
||||
1,
|
||||
'',
|
||||
new StringCollection([
|
||||
'test1' => 'I am 1st',
|
||||
'test2' => 'I am 2nd',
|
||||
|
||||
Reference in New Issue
Block a user