diff --git a/Strategy/ObjectCollection.php b/Strategy/ObjectCollection.php index 682a8d0..57836ad 100644 --- a/Strategy/ObjectCollection.php +++ b/Strategy/ObjectCollection.php @@ -30,6 +30,10 @@ class ObjectCollection */ public function sort() { + if (!$this->comparator){ + throw new \LogicException("Comparator is not set"); + } + $callback = array($this->comparator, 'compare'); uasort($this->elements, $callback);