export interface PhpNamespaceResolution {
    class_name: string;
    namespace: string;
    file_path: string | null;
    exists: boolean;
    psr4_root: string | null;
    psr4_prefix: string | null;
}
export declare function resolvePhpNamespace(repo: string, className: string): Promise<PhpNamespaceResolution>;
export interface ActiveRecordModel {
    name: string;
    file: string;
    table_name: string | null;
    relations: {
        name: string;
        type: "hasOne" | "hasMany" | "manyMany";
        target_class: string;
    }[];
    rules: string[];
    behaviors: string[];
    methods: string[];
}
export interface ActiveRecordAnalysis {
    models: ActiveRecordModel[];
    total: number;
}
export declare function analyzeActiveRecord(repo: string, options?: {
    model_name?: string;
    file_pattern?: string;
}): Promise<ActiveRecordAnalysis>;
export interface PhpEventChain {
    event_name: string;
    triggers: {
        file: string;
        line: number;
        context: string;
    }[];
    listeners: {
        file: string;
        line: number;
        context: string;
    }[];
}
export declare function tracePhpEvent(repo: string, options?: {
    event_name?: string;
}): Promise<{
    events: PhpEventChain[];
    total: number;
}>;
export type PhpRenderKind = "full" | "partial" | "ajax" | "json" | "file";
export interface PhpViewMapping {
    controller: string;
    action: string;
    view_name: string;
    /** Resolved view file path or null when the file isn't present in the
     *  index. Resolution prefers explicit path aliases, falls back to the
     *  Yii2 convention `views/{controller-id}/{view}.php`. */
    view_file: string | null;
    render_line: number;
    /** Sprint 8: render method flavor — `render` vs `renderPartial`/`renderAjax`/
     *  `renderAsJson`/`renderFile`. Useful for caching audits (full templates
     *  often inherit a layout, partials usually don't). */
    render_kind: PhpRenderKind;
    /** Sprint 8: when the render() argument starts with a `@alias/...`
     *  expression, this captures the alias. null for relative names. */
    path_alias: string | null;
}
export interface PhpLayoutMapping {
    controller: string;
    action: string | null;
    /** The layout name as written: 'main', '@app/views/layouts/admin', etc. */
    layout: string;
    /** Resolved file path or null when the alias couldn't be resolved. */
    layout_file: string | null;
    set_at_line: number;
}
export interface PhpWidgetReference {
    /** Widget class name as written (last namespace segment). */
    widget: string;
    /** Caller method's containing class — usually a controller, view, or
     *  another widget. */
    caller_class: string | null;
    caller_method: string | null;
    file: string;
    line: number;
    /** "begin" for `Widget::begin([...])`, "widget" for `Widget::widget([...])`. */
    kind: "begin" | "widget";
}
export interface PhpAssetBundleRef {
    /** Asset bundle class name (last namespace segment). */
    bundle: string;
    /** File registering the bundle (typically a view or layout). */
    file: string;
    line: number;
}
export interface FindPhpViewsResult {
    mappings: PhpViewMapping[];
    total: number;
    /** Sprint 8: layout assignments (`$this->layout = '...'`) per action. */
    layouts: PhpLayoutMapping[];
    /** Sprint 8: widget references across views + controllers. */
    widgets: PhpWidgetReference[];
    /** Sprint 8: AssetBundle::register() call sites. */
    asset_bundles: PhpAssetBundleRef[];
}
/**
 * Yii2 view + layout + widget + asset-bundle inventory.
 *
 * Beyond the original render→view mapping (Sprint 1), the tool now also:
 *   - Distinguishes render flavors (full/partial/ajax/json/file) so
 *     downstream caching/SEO audits can scope their checks.
 *   - Resolves `@alias/...` paths via the path-alias map sourced from
 *     `Yii::setAlias()` calls and `aliases` keys in config files.
 *   - Captures `$this->layout = '...'` assignments (controller-wide and
 *     per-action overrides).
 *   - Lists widget references (`GridView::begin/widget`) found anywhere
 *     in the codebase.
 *   - Lists `AssetBundle::register($this)` calls.
 */
export declare function findPhpViews(repo: string, options?: {
    controller?: string;
    include_widgets?: boolean;
    include_asset_bundles?: boolean;
}): Promise<FindPhpViewsResult>;
export interface PhpServiceResolution {
    name: string;
    class: string | null;
    file: string | null;
    config_file: string | null;
    /** Sprint 3: tracks where the service was defined.
     *   "components"           — top-level Yii2 application components
     *   "container.singletons" — DI container singletons
     *   "container.definitions"— DI container regular bindings
     *   "module:<id>"          — module-scoped components (modules.<id>.components.X)
     *   "factory"              — closure / factory function (no static class resolution)
     */
    source: string;
    /** Sprint 3: true when the service was defined as a closure/factory and we
     *  cannot statically determine the produced class. Caller can choose to
     *  skip these or surface them as TODOs. */
    is_factory?: boolean;
}
export declare function resolvePhpService(repo: string, options?: {
    service_name?: string;
}): Promise<{
    services: PhpServiceResolution[];
    total: number;
}>;
export interface PhpSecurityFinding {
    severity: "critical" | "high" | "medium" | "low";
    pattern: string;
    file: string;
    line: number;
    context: string;
    description: string;
}
export interface PhpSecurityScanResult {
    findings: PhpSecurityFinding[];
    summary: {
        critical: number;
        high: number;
        medium: number;
        low: number;
        total: number;
    };
    checks_run: string[];
}
export declare function phpSecurityScan(repo: string, options?: {
    file_pattern?: string;
    checks?: string[];
}): Promise<PhpSecurityScanResult>;
export interface NPlusOneFinding {
    file: string;
    method: string;
    line: number;
    relation: string;
    pattern: string;
}
/**
 * Detect N+1 query patterns in Yii2/Eloquent controllers.
 *
 * Pattern: `foreach ($items as $item) { $item->relation->... }` without a
 * prior `->with('relation')` call in the same method scope. This is the
 * most common N+1 anti-pattern in Yii2 ActiveRecord code.
 *
 * Known limitations (acceptable for a "discovery" tool, not a gate):
 * - Regex-based — can miss multi-line foreach bodies split across nested blocks
 * - Doesn't cross function boundaries — eager loading in caller is invisible
 * - False positives on nested loops if the outer collection is already eager-loaded
 */
export declare function findPhpNPlusOne(repo: string, options?: {
    limit?: number;
    file_pattern?: string;
}): Promise<{
    findings: NPlusOneFinding[];
    total: number;
}>;
export interface GodModelFinding {
    name: string;
    file: string;
    method_count: number;
    relation_count: number;
    line_count: number;
    reasons: string[];
}
/**
 * Flag oversized PHP classes. Two scopes:
 *
 * - `scope: "activerecord"` (default) — only models extending ActiveRecord.
 *   Uses `analyzeActiveRecord` for model detection and counts relations as a
 *   third threshold alongside methods and lines. Classic Yii2 god-model case:
 *   Survey.php in Mobi2 with 175 methods, 30 relations, 2291 lines.
 *
 * - `scope: "all"` — every PHP class in the index, regardless of base class.
 *   Captures service god-classes (UserService with 80 methods), component
 *   aggregates, and any other PHP class that outgrew its responsibility.
 *   `relation_count` is 0 for non-AR classes — the `min_relations` check is
 *   skipped so a service with 60 methods isn't hidden by a relation threshold.
 *
 * Thresholds default to 50/15/500 but are configurable for both scopes.
 */
export declare function findPhpGodModel(repo: string, options?: {
    min_methods?: number;
    min_relations?: number;
    min_lines?: number;
    scope?: "activerecord" | "all";
}): Promise<{
    models: GodModelFinding[];
    total: number;
}>;
export interface AuditGate {
    name: string;
    status: "ok" | "error" | "timeout";
    findings_count: number;
    duration_ms: number;
    error?: string;
}
export interface PhpProjectAudit {
    repo: string;
    duration_ms: number;
    checks_run: string[];
    gates: AuditGate[];
    summary: {
        total_findings: number;
        critical: number;
        high: number;
        medium: number;
        low: number;
        health_score: number;
        top_risks: string[];
    };
    security: PhpSecurityScanResult;
    activerecord: ActiveRecordAnalysis;
}
export declare function phpProjectAudit(repo: string, options?: {
    file_pattern?: string;
    checks?: string[];
}): Promise<PhpProjectAudit>;
//# sourceMappingURL=php-tools.d.ts.map