當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Type::isNullable方法代碼示例

本文整理匯總了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());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:10,代碼來源:ObjectType.php

示例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());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:10,代碼來源:ArrayType.php

示例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());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:10,代碼來源:IterableIterableType.php

示例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());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:11,代碼來源:JustNullableTypeTrait.php

示例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());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:13,代碼來源:CallableType.php

示例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;
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:16,代碼來源:TypehintHelper.php

示例7: combineWith

 public function combineWith(Type $otherType) : Type
 {
     return new self($this->baseClass, $this->isNullable() || $otherType->isNullable());
 }
開發者ID:phpstan,項目名稱:phpstan,代碼行數:4,代碼來源:StaticType.php


注:本文中的Type::isNullable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。