From e35d8bfe0c0e2bd3e23340b594c4ba1dd602a760 Mon Sep 17 00:00:00 2001
From: Martynas Sudintas <martynas.sudintas@ongr.io>
Date: Wed, 1 Apr 2015 12:57:33 +0300
Subject: [PATCH] refactored Bool::addToBool method

---
 Bool/Bool.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Bool/Bool.php b/Bool/Bool.php
index 589be16..69194fe 100644
--- a/Bool/Bool.php
+++ b/Bool/Bool.php
@@ -50,11 +50,13 @@ class Bool implements BuilderInterface
      */
     public function addToBool(BuilderInterface $bool, $type = self::MUST)
     {
-        if (in_array($type, [ self::MUST, self::MUST_NOT, self::SHOULD ])) {
-            $this->container[$type][] = $bool;
-        } else {
+        $constants = (new \ReflectionObject($this))->getConstants();
+
+        if (!in_array($type, $constants)) {
             throw new \UnexpectedValueException(sprintf('The bool operator %s is not supported', $type));
         }
+
+        $this->container[$type][] = $bool;
     }
 
     /**
-- 
GitLab