use std::sync::Arc;
use mir_types::Union;
use php_ast::Span;
#[derive(Debug, Clone)]
pub struct ResolvedSymbol {
pub file: Arc<str>,
pub span: Span,
pub kind: SymbolKind,
pub resolved_type: Union,
}
impl ResolvedSymbol {
pub fn codebase_key(&self) -> Option<String> {
match &self.kind {
SymbolKind::MethodCall { class, method } | SymbolKind::StaticCall { class, method } => {
Some(format!("{}::{}", class, method.to_lowercase()))
}
SymbolKind::PropertyAccess { class, property } => {
Some(format!("{}::{}", class, property))
}
SymbolKind::FunctionCall(fqn) => Some(fqn.to_string()),
SymbolKind::ClassReference(fqcn) => Some(fqcn.to_string()),
SymbolKind::Variable(_) => None,
}
}
}
#[derive(Debug, Clone)]
pub enum SymbolKind {
Variable(String),
MethodCall { class: Arc<str>, method: Arc<str> },
StaticCall { class: Arc<str>, method: Arc<str> },
PropertyAccess { class: Arc<str>, property: Arc<str> },
FunctionCall(Arc<str>),
ClassReference(Arc<str>),
}