export type PhpFunctionRange = { end: number; source: string; start: number; }; /** Options controlling whether PHP call helpers scan snippets or full PHP files. */ export type PhpFunctionCallScanOptions = { /** Ignore text outside explicit PHP open/close tag regions. */ requirePhpOpenTag?: boolean; }; export type PhpFunctionRangeOptions = PhpFunctionCallScanOptions & { includeTrailingNewlines?: boolean; }; export type ReplacePhpFunctionDefinitionOptions = PhpFunctionRangeOptions & { trimReplacementStart?: boolean; }; export declare function escapeRegex(value: string): string; export declare function quotePhpString(value: string): string; export declare function hasPhpFunctionDefinition(source: string, functionName: string): boolean; /** * Detect a PHP function call outside strings, comments, heredoc, and nowdoc blocks. * * @param source PHP source to scan. * @param functionName Literal PHP function identifier to find. * @param options Scanner options for full files that require explicit PHP tags. * @returns Whether `source` contains a code-mode call to `functionName`. */ export declare function hasPhpFunctionCall(source: string, functionName: string, options?: PhpFunctionCallScanOptions): boolean; /** * Find the exclusive end offset of one PHP function call at a known offset. * * Parentheses inside strings, comments, heredoc, and nowdoc blocks are ignored * by the same scanner used by {@link hasPhpFunctionCall}. * * @param source PHP source containing the call. * @param functionOffset Offset where the function identifier starts. * @param functionName Literal PHP function identifier expected at the offset. * @param options Scanner options for full files that require explicit PHP tags. * @returns The offset after the matching closing parenthesis, or `null`. */ export declare function findPhpFunctionCallEnd(source: string, functionOffset: number, functionName: string, options?: PhpFunctionCallScanOptions): number | null; type PhpStringArgumentMatcher = string | ((value: string) => boolean); /** * Detect a PHP function call whose leading arguments are literal strings that * satisfy the supplied matchers. * * Each matcher applies to the corresponding argument in the same code-mode * function call. Additional arguments after the matched prefix are allowed. * * @param source PHP source to scan. * @param functionName Literal PHP function identifier to find. * @param argumentMatchers Matchers for the leading literal string arguments. * @param options Scanner options for full files that require explicit PHP tags. * @returns Whether one code-mode call satisfies every supplied matcher. */ export declare function hasPhpFunctionCallWithStringArguments(source: string, functionName: string, argumentMatchers: readonly PhpStringArgumentMatcher[], options?: PhpFunctionCallScanOptions): boolean; /** * Detect a PHP function call whose first argument is a variable previously * assigned from a literal string prefix in executable PHP code. */ export declare function hasPhpFunctionCallWithAssignedStringPrefixArgument(source: string, functionName: string, literalPrefix: string): boolean; /** * Detect a PHP function call whose first argument is a literal string value. * * This uses the same code-mode scanner as {@link hasPhpFunctionCall}, so * comments, quoted strings, heredoc, and nowdoc content cannot create matches. */ export declare function hasPhpFunctionCallWithStringArgument(source: string, functionName: string, literalArgument: string): boolean; /** * Detect a PHP function call whose first argument starts with a literal string prefix. * * Concatenated expressions are accepted here so dynamic WordPress hooks such as * `'block_bindings_supported_attributes_' . $block_type` remain detectable. */ export declare function hasPhpFunctionCallWithStringArgumentPrefix(source: string, functionName: string, literalPrefix: string): boolean; /** * Detect a code-mode PHP string literal that starts with a literal prefix. * * This is useful for dynamic hook names stored in variables before a later * global function call consumes the variable. */ export declare function hasPhpCodeStringLiteralPrefix(source: string, literalPrefix: string): boolean; /** Return the PHP code-block brace depth at an executable source offset. */ export declare function getPhpCodeBraceDepth(source: string, offset: number, options?: PhpFunctionCallScanOptions): number | null; /** * Locate a PHP function body without counting braces in non-code regions. * * @param source PHP source to scan. * @param functionName Literal PHP function identifier to locate. * @param options Range options such as trailing newline inclusion. * @returns The matched {@link PhpFunctionRange}, or `null` when no safe range exists. */ export declare function findPhpFunctionRange(source: string, functionName: string, options?: PhpFunctionRangeOptions): PhpFunctionRange | null; export declare function replacePhpFunctionDefinition(source: string, functionName: string, replacement: string, options?: ReplacePhpFunctionDefinitionOptions): string | null; export {};