Example #1
0
 public function __construct($initial_value = 0, $strict = false)
 {
     if ($strict && !\is_int($initial_value)) {
         throw new \InvalidArgumentException("Value not an integer");
     }
     parent::__construct($initial_value, $strict);
     if (!\is_int($initial_value)) {
         throw new \UnexpectedValueException("Value not an integer");
     }
 }
Example #2
0
 public function __construct($initial_value = null, $strict = false)
 {
     echo \get_class($this);
     $reflect = new \ReflectionClass(\get_class());
     $this->__values = (array) $reflect->getConstants();
     var_dump($this->__values);
     if ($strict && !\in_array($initial_value, $this->__values)) {
         throw new \InvalidArgumentException("Value not a float");
     }
     parent::__construct($initial_value, $strict);
     if (!\in_array($initial_value, $this->__values)) {
         throw new \UnexpectedValueException("Value not a const in enum " . __CLASS__);
     }
 }