reflections
Table of Contents
Functions
- getFunctionInfo() : array<string|int, mixed>|null
- Returns detailed reflection information about a given function or method.
Functions
getFunctionInfo()
Returns detailed reflection information about a given function or method.
getFunctionInfo(callable|string $callable) : array<string|int, mixed>|null
This function uses PHP's Reflection API to retrieve metadata about a callable (function, method, or closure), including its namespace, file location, line numbers, and docblock comment.
Parameters
- $callable : callable|string
-
The callable to reflect: function name, closure, or method (as string or array).
Tags
Return values
array<string|int, mixed>|null —Returns an associative array of function details if the function exists, or null otherwise. The array contains:
- 'name' : Full function or method name including class if applicable.
- 'namespace' : Namespace the function or method belongs to.
- 'alias' : Short function or method name without namespace.
- 'file' : Path to the file where the function or method is defined.
- 'startLine' : The starting line number of the function or method definition.
- 'endLine' : The ending line number of the function or method definition.
- 'isInternal' : Whether the function or method is internal to PHP.
- 'isUser' : Whether the function or method is user-defined.
- 'comment' : The function's or method's docblock comment, or null if none.