isEqualTo() public method

Whether the supplied type is equivalent to the current type.
public isEqualTo ( Pinq\Analysis\IType $type ) : boolean
$type Pinq\Analysis\IType
return boolean
 protected function assertEqualTypes(IType $expected, IType $actual, $message = '')
 {
     $this->assertSame($expected->getIdentifier(), $actual->getIdentifier(), $message);
     $this->assertTrue($expected->isEqualTo($actual), $message);
     $this->assertTrue($actual->isEqualTo($expected), $message);
     $this->assertSame($expected, $actual, $message);
 }
Example #2
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);
 }