SlotExecutionGuard
SlotExecutionGuard centralizes recursion limit enforcement for slot dispatches.
Synopsis
Section titled “Synopsis”final readonly class SlotExecutionGuard
| Source | Execution/SlotExecutionGuard.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(int $limit): mixed
| Parameter | Type | Description |
|---|---|---|
$limit | int |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
enter(SlotStack $stack, string $key): void | Push the key and throw if over the hard limit. |
leave(SlotStack $stack): void | Remove the last pushed key. |
wouldExceed(SlotStack $stack, string $key): bool | Non-throwing check: would pushing this key exceed the configured limit? |
enter()
Section titled “enter()”public function enter(SlotStack $stack, string $key): void
Push the key and throw if over the hard limit.
| Parameter | Type | Description |
|---|---|---|
$stack | SlotStack | |
$key | string |
leave()
Section titled “leave()”public function leave(SlotStack $stack): void
Remove the last pushed key.
| Parameter | Type | Description |
|---|---|---|
$stack | SlotStack |
wouldExceed()
Section titled “wouldExceed()”public function wouldExceed(SlotStack $stack, string $key): bool
Non-throwing check: would pushing this key exceed the configured limit?
Useful to allow callers to fail soft (return empty) instead of throwing.
| Parameter | Type | Description |
|---|---|---|
$stack | SlotStack | |
$key | string |
Returns bool