예제 #1
0
 public function isSubTypeOf(PhpType $that)
 {
     if ($that->isBooleanType()) {
         return true;
     }
     return parent::isSubTypeOf($that);
 }
 private function restrictByScalarType(PhpType $type = null, $outcome)
 {
     if ($outcome) {
         return $this->typeRegistry->getNativeType('scalar');
     }
     if (null === $type) {
         return null;
     }
     if ($type->isIntegerType() || $type->isDoubleType() || $type->isStringType() || $type->isBooleanType()) {
         return $this->typeRegistry->getNativeType('none');
     }
     if ($type->isUnionType()) {
         return $type->getRestrictedUnion($this->typeRegistry->getNativeType('scalar'));
     }
     if ($type->isAllType()) {
         return $this->typeRegistry->createUnionType(array('object', 'array', 'null'));
     }
     return $type;
 }