isParentTypeOf() public méthode

Whether the supplied type is a subtype of or equal to the current type.
public isParentTypeOf ( Pinq\Analysis\IType $type ) : boolean
$type Pinq\Analysis\IType
Résultat boolean
Exemple #1
0
 public function getCommonAncestorType(IType $type, IType $otherType)
 {
     if ($type->isEqualTo($otherType)) {
         return $type;
     } elseif ($type->isParentTypeOf($otherType)) {
         return $type;
     } elseif ($otherType->isParentTypeOf($type)) {
         return $otherType;
     }
     $parentTypes = $this->getAncestorTypes($type);
     $otherParentTypes = $this->getAncestorTypes($otherType);
     /** @var $commonParentTypes IType[] */
     $commonParentTypes = array_intersect_key($parentTypes, $otherParentTypes);
     return $this->getCompositeType($commonParentTypes);
 }