Shutdown
Register an instance method for runtime shutdown.
Purpose & processing
Autowire registers annotated methods with Core\Shutdown when the shutdown controller is already registered.
Parameters
| Parameter | Type | Default | Behavior |
|---|---|---|---|
| priority | int | 0 | Higher priorities execute before lower priorities. |
Example
#[Shutdown(priority: 100)]
public function flushPendingChanges(): void
{
// Flush buffered data.
}
Behavior and considerations
- Target: method. The method must be non-static and must not require arguments.
- Registration can be skipped if Core\Shutdown is not registered when autowiring occurs.
- Declaring the attribute does not immediately execute the method.
Source
shared/src/Core/Annotation/Shutdown.php