diff --git a/CHANGELOG.md b/CHANGELOG.md index daec50e..f3f4780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/VERSION b/VERSION index 9084fa2..524cb55 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.0 +1.1.1 diff --git a/src/Traits/Collection/AddTrait.php b/src/Traits/Collection/AddTrait.php index 1cda8b2..4ac35aa 100644 --- a/src/Traits/Collection/AddTrait.php +++ b/src/Traits/Collection/AddTrait.php @@ -30,7 +30,7 @@ trait AddTrait return; } - if (null === $index || '' === $index) { + if (null === $index) { $this->elements[] = $element; return; diff --git a/tests/Collection/BaseCollectionTest.php b/tests/Collection/BaseCollectionTest.php index 2906193..0f7a482 100644 --- a/tests/Collection/BaseCollectionTest.php +++ b/tests/Collection/BaseCollectionTest.php @@ -438,7 +438,7 @@ class BaseCollectionTest extends BaseTestCase 'This is test 4', '', 4, - 1, + '', new StringCollection([ 'test1' => 'I am 1st', 'test2' => 'I am 2nd',