FunctionNode
interface FunctionNode (View source)
Parser-agnostic interface for function AST nodes.
Implementations wrap specific parser library nodes (e.g., nikic/php-parser).
Methods
Get the function name.
Get the function parameters.
Get the return type node, or null if no return type.
Get the doc comment node, or null if no doc comment.
Set the namespace for this function.
Get the namespace for this function.
Get the function attributes (PHP 8.0+).
Set the imports (use statements) for this function's file context.
Get the imports (use statements) for this function's file context.
Details
string
getName()
Get the function name.
array
getParameters()
Get the function parameters.
TypeNode|null
getReturnType()
Get the return type node, or null if no return type.
DocCommentNode|null
getDocComment()
Get the doc comment node, or null if no doc comment.
void
setNamespace(string $namespace)
Set the namespace for this function.
string
getNamespace()
Get the namespace for this function.
array
getAttributes()
Get the function attributes (PHP 8.0+).
void
setImports(array $imports)
Set the imports (use statements) for this function's file context.
Maps alias names to fully qualified class names.
array
getImports()
Get the imports (use statements) for this function's file context.