From 52a54737209cc52fb483387cb87c7f882c2172a0 Mon Sep 17 00:00:00 2001 From: Evan Coury Date: Fri, 4 Nov 2011 09:16:39 -0700 Subject: [PATCH 1/2] Allow for object identifier in ProvidesEvents trait --- src/ProvidesEvents.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ProvidesEvents.php b/src/ProvidesEvents.php index 2ca8cc5..8c82a26 100644 --- a/src/ProvidesEvents.php +++ b/src/ProvidesEvents.php @@ -69,6 +69,8 @@ public function events() || ($this->eventIdentifier instanceof Traversable) ) { $identifiers = array_unique($identifiers + (array) $this->eventIdentifier); + } elseif (is_object($this->eventIdentifier)) { + $identifiers[] = $this->eventIdentifier; } // silently ignore invalid eventIdentifier types } From bfef7f04fb3b3f5aef783e10ec5008b55e1f94ef Mon Sep 17 00:00:00 2001 From: Evan Coury Date: Thu, 10 Nov 2011 10:47:09 -0700 Subject: [PATCH 2/2] Use array_merge, as performing a union replaces indexed array keys --- src/ProvidesEvents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProvidesEvents.php b/src/ProvidesEvents.php index 8c82a26..6420679 100644 --- a/src/ProvidesEvents.php +++ b/src/ProvidesEvents.php @@ -68,7 +68,7 @@ public function events() || (is_array($this->eventIdentifier)) || ($this->eventIdentifier instanceof Traversable) ) { - $identifiers = array_unique($identifiers + (array) $this->eventIdentifier); + $identifiers = array_unique(array_merge($identifiers, (array) $this->eventIdentifier)); } elseif (is_object($this->eventIdentifier)) { $identifiers[] = $this->eventIdentifier; }