APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

NoReturn

Metadata for functions and methods that do not return control.

Purpose & processing

Marks a function or method intended to terminate or transfer the current execution flow, rather than return normally.

Parameters

Parameter Type Default Behavior
...arguments mixed [] Optional positional matching metadata; ANY_ARGUMENT is defined as a wildcard constant.

Example

#[NoReturn]
public function exit(int $code = 0): never
{
    // Terminate the execution flow.
}

Behavior and considerations

  • Targets functions and methods.
  • Unlike void, never means normal return to the caller does not occur.
  • The attribute does not itself terminate execution; its arguments are not evaluated by the Autowire resolver.
  • NoReturn::ANY_ARGUMENT is available for argument-matching metadata; do not assume it enforces runtime behavior.

Source

shared/src/Core/Annotation/NoReturn.php

Next Steps

Previous

Cached

Explore Cached

Next

Data & Persistence

Explore Data & Persistence