本文整理汇总了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());
}