저자: Elliot Levin (elliotlevin@hotmail.com)
예제 #1
0
 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);
 }
예제 #2
0
 public function isParentTypeOf(IType $type)
 {
     if ($type instanceof IObjectType) {
         return is_a($type->getClassType(), $this->classType, true);
     }
     return false;
 }
예제 #3
0
파일: Type.php 프로젝트: timetoogo/pinq
 public function getUnaryOperation(O\UnaryOperationExpression $expression)
 {
     if (isset($this->unaryOperations[$expression->getOperator()])) {
         return $this->unaryOperations[$expression->getOperator()];
     }
     return $this->parentType->getUnaryOperation($expression);
 }
예제 #4
0
 protected function getAncestorTypes(IType $type)
 {
     $ancestorTypes = [$type->getIdentifier() => $type];
     if (!$type->hasParentType()) {
         return $ancestorTypes;
     }
     if ($type instanceof ICompositeType) {
         foreach ($type->getComposedTypes() as $composedType) {
             $ancestorTypes += $this->getAncestorTypes($composedType);
         }
     } else {
         $parentType = $type->getParentType();
         $ancestorTypes[$parentType->getIdentifier()] = $parentType;
         $ancestorTypes += $this->getAncestorTypes($parentType);
     }
     return $ancestorTypes;
 }