/**
  * @param ValueType|string $type
  * @return Value
  * @throws NoSuchValueTypeException
  */
 public static function constructNull($type)
 {
     $type = new ValueType($type);
     switch ($type->getCode()) {
         case ValueType::STRING:
             return new TextValue(null);
         case ValueType::NUMBER:
             return new NumberValue(null);
         case ValueType::BOOLEAN:
             return new BooleanValue(null);
         case ValueType::DATE:
             return new DateValue(null);
         case ValueType::DATETIME:
             return new DateTimeValue(null);
         case ValueType::TIMEOFDAY:
             return new TimeOfDayValue(null);
         default:
             throw new NoSuchValueTypeException($type->getCode());
     }
 }
 /**
  * @param ValueType|int $code
  * @throws NoSuchValueTypeException
  */
 public function __construct($code)
 {
     if ($code instanceof ValueType) {
         $this->code = $code->getCode();
     } else {
         if (!isset(self::$typeNames[$code])) {
             throw new NoSuchValueTypeException($code);
         }
         $this->code = $code;
     }
 }
 public function testCopyConstructor()
 {
     $type1 = new ValueType(ValueType::NUMBER);
     $type2 = new ValueType($type1);
     $this->assertSame($type1->getCode(), $type2->getCode(), "type2 must be of the same type as type1");
 }