本文整理匯總了PHP中Type::isNullable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Type::isNullable方法的具體用法?PHP Type::isNullable怎麽用?PHP Type::isNullable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Type
的用法示例。
在下文中一共展示了Type::isNullable方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: combineWith
public function combineWith(Type $otherType) : Type
{
if ($otherType instanceof self && $this->getClass() == $otherType->getClass()) {
return new self($this->getClass(), $this->isNullable() || $otherType->isNullable());
}
if ($otherType instanceof NullType) {
return $this->makeNullable();
}
return new MixedType($this->isNullable() || $otherType->isNullable());
}
示例2: combineWith
public function combineWith(Type $otherType) : Type
{
if ($otherType instanceof ArrayType) {
return new self($this->getItemType()->combineWith($otherType->getItemType()), $this->isNullable() || $otherType->isNullable(), $this->isItemTypeInferredFromLiteralArray() || $otherType->isItemTypeInferredFromLiteralArray(), $this->isPossiblyCallable() || $otherType->isPossiblyCallable());
}
if ($otherType instanceof NullType) {
return $this->makeNullable();
}
return new MixedType($this->isNullable() || $otherType->isNullable());
}
示例3: combineWith
public function combineWith(Type $otherType) : Type
{
if ($otherType instanceof IterableType) {
return new self($this->getItemType()->combineWith($otherType->getItemType()), $this->isNullable() || $otherType->isNullable());
}
if ($otherType instanceof NullType) {
return $this->makeNullable();
}
return new MixedType($this->isNullable() || $otherType->isNullable());
}
示例4: combineWith
public function combineWith(Type $otherType) : Type
{
if ($otherType instanceof $this) {
$thisClass = get_class($this);
return new $thisClass($this->isNullable() || $otherType->isNullable());
}
if ($otherType instanceof NullType) {
return $this->makeNullable();
}
return new MixedType($this->isNullable() || $otherType->isNullable());
}
示例5: combineWith
public function combineWith(Type $otherType) : Type
{
if ($otherType instanceof self) {
return new self($this->isNullable() || $otherType->isNullable());
}
if ($otherType instanceof ArrayType && $otherType->isPossiblyCallable()) {
return $this;
}
if ($otherType instanceof NullType) {
return $this->makeNullable();
}
return new MixedType($this->isNullable() || $otherType->isNullable());
}
示例6: decideType
public static function decideType(Type $type, Type $phpDocType = null) : Type
{
if ($phpDocType !== null) {
if ($type instanceof IterableType && $phpDocType instanceof ArrayType) {
if ($type instanceof IterableIterableType) {
$phpDocType = new IterableIterableType($phpDocType->getItemType(), $type->isNullable() || $phpDocType->isNullable());
} elseif ($type instanceof ArrayType) {
$type = new ArrayType($phpDocType->getItemType(), $type->isNullable() || $phpDocType->isNullable());
}
}
if ($type->accepts($phpDocType)) {
return $phpDocType;
}
}
return $type;
}
示例7: combineWith
public function combineWith(Type $otherType) : Type
{
return new self($this->baseClass, $this->isNullable() || $otherType->isNullable());
}