private function getReturnTypeAsString(PhpType $type, array $importedNamespaces) { if ($type->isNullType() || $type->isNoType()) { return 'void'; } return $type->getDocType($importedNamespaces); }
/** * Computes the restricted types given a non-successful shallow equality comparison. * * @return PhpType[] The first element is the restricted this type, the second element is the restricted type of the * passed type. */ public function getTypesUnderShallowInequality(PhpType $that) { // union types if ($that->isUnionType()) { $p = $that->toMaybeUnionType()->getTypesUnderShallowInequality($this); return array($p[1], $p[0]); } // Other types. // There are only two types whose shallow inequality is deterministically // true -- null and false. We can just enumerate them. Should we ever add // a true type, this needs to be added here as well. if ($this->isNullType() && $that->isNullType()) { return array(null, null); } if ($this->isFalse() && $that->isFalse()) { return array(null, null); } return array($this, $that); }