mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Collection > add() method > treat empty string as not provided index (same as null)
This commit is contained in:
@@ -109,7 +109,7 @@ class Collection implements Countable, ArrayAccess, IteratorAggregate
|
||||
*/
|
||||
public function add($element, $index = null)
|
||||
{
|
||||
if (null === $index) {
|
||||
if (null === $index || '' === $index) {
|
||||
$this->elements[] = $element;
|
||||
} else {
|
||||
$this->elements[$index] = $element;
|
||||
|
||||
Reference in New Issue
Block a user