public function testForEquality(PhpType $that)
 {
     if (null !== ($rs = parent::testForEquality($that))) {
         return $rs;
     }
     if ($that->isIntegerType() || $that->isDoubleType() || $that->isNullType() || $that->isResourceType() || $that->isNullType() || $that->isBooleanType()) {
         return TernaryValue::get('false');
     }
     return TernaryValue::get('unknown');
 }
 public function testForEquality(PhpType $that)
 {
     if (null !== ($rs = parent::testForEquality($that))) {
         return $rs;
     }
     if ($that->isObjectType() || $that->isNoObjectType() || $that->isArrayType() || $that->isNullType() || $that->isCallableType()) {
         return TernaryValue::get('false');
     }
     return TernaryValue::get('unknown');
 }
 public function testForEquality(PhpType $that)
 {
     $rs = parent::testForEquality($that);
     if (null !== $rs) {
         return $rs;
     }
     if ($that->isUnknownType() || $that->isResourceType() || $that->isSubTypeOf($this->registry->getNativeType('object_number_string_boolean'))) {
         return TernaryValue::get('unknown');
     }
     return TernaryValue::get('false');
 }
 public function testForEquality(PhpType $that)
 {
     $rs = parent::testForEquality($that);
     if ($rs !== null) {
         return $rs;
     }
     if ($that->isUnknownType() || $that->isNullType() || $that->isStringType() || $that->isIntegerType() || $that->isResourceType() || $that->isDoubleType()) {
         return TernaryValue::get('unknown');
     }
     return TernaryValue::get('false');
 }
 public function xorOp(TernaryValue $that)
 {
     switch ($this->type) {
         case 'false':
             return $that;
         case 'true':
             return $that->notOp();
         case 'unknown':
             return $this;
     }
     throw new \InvalidArgumentException('switch() is exhaustive.');
 }
 public function testForEquality(PhpType $that)
 {
     $rs = parent::testForEquality($that);
     if ($rs !== null) {
         return $rs;
     }
     if ($that->isNullType()) {
         return TernaryValue::get('true');
     }
     if ($that->isUnknownType() || $that->isNullable()) {
         return TernaryValue::get('unknown');
     }
     return TernaryValue::get('false');
 }
 public function testForEquality(PhpType $that)
 {
     $rs = parent::testForEquality($that);
     if (null !== $rs) {
         return $rs;
     }
     // Objects are comparable to objects only (by comparing their property
     // values). The no object type represents a generic object.
     if ($that->isObjectType() || $that->isNoObjectType()) {
         return TernaryValue::get('unknown');
     }
     // If the other value is no object, then PHP will raise a warning in
     // most cases, and if not the comparison is false.
     return TernaryValue::get('false');
 }
 public function testForEquality(PhpType $that)
 {
     if ($this->isNoResolvedType() && ($that->isObjectType() || $that->isNoObjectType())) {
         return TernaryValue::get('unknown');
     }
     return $this->referencedType->testForEquality($that);
 }
 public function testForEquality(PhpType $that)
 {
     return TernaryValue::get('unknown');
 }
 public function testForEquality(PhpType $that)
 {
     $rs = parent::testForEquality($that);
     if (null !== $rs) {
         return $rs;
     }
     // Most of (all?) of the array cases are already handled by the
     // default implementation.
     return TernaryValue::get('false');
 }
 public function testForEquality(PhpType $that)
 {
     $result = null;
     foreach ($this->alternates as $t) {
         $test = $t->testForEquality($that);
         if (null === $result) {
             $result = $test;
         } else {
             if ($result !== $test) {
                 return TernaryValue::get('unknown');
             }
         }
     }
     return $result;
 }