/** * Checks this type is compatible with another type * Note: implementation of IType::isCompatibleWith * * @param IType $type Type to check compatibility * * @return boolean */ public function isCompatibleWith(IType $type) { switch ($type->getTypeCode()) { case TypeCode::BYTE: case TypeCode::CHAR: return true; } return false; }
/** * Checks expression is a specific type * * @param IType $type The type to check * * @return boolean */ public function typeIs(IType $type) { return $this->type->getTypeCode() == $type->getTypeCode(); }
/** * Checks this type (Void) is compatible with another type * Note: implementation of IType::isCompatibleWith * * @param IType $type Type to check compatibility * * @return boolean */ public function isCompatibleWith(IType $type) { return $type->getTypeCode() == TypeCode::VOID; }