phpbotgram

States
in package

FinalYes

Module-level FSM state sentinels.

Mirrors the two free constants defined at the bottom of aiogram/fsm/state.py:

default_state = State()       # no-state sentinel
any_state     = State('*')    # always-match sentinel

PHP cannot declare top-level object constants; instead, two static singleton getters are provided so callers write States::default() and States::any() rather than constructing the sentinels themselves.

The instances are lazy-initialised on first access and reused thereafter.

Table of Contents

Properties

$anyInstance  : State|null
Lazily-initialised `any_state` singleton.
$defaultInstance  : State|null
Lazily-initialised `default_state` singleton.

Methods

any()  : State
Return the always-match sentinel (`any_state` in upstream).
default()  : State
Return the no-state sentinel (`default_state` in upstream).
__construct()  : mixed
Prevent instantiation — this class is a static namespace only.

Properties

$anyInstance

Lazily-initialised `any_state` singleton.

private static State|null $anyInstance = null

$defaultInstance

Lazily-initialised `default_state` singleton.

private static State|null $defaultInstance = null

Methods

any()

Return the always-match sentinel (`any_state` in upstream).

public static any() : State

state() returns '*'; __invoke always returns true.

Return values
State

default()

Return the no-state sentinel (`default_state` in upstream).

public static default() : State

state() returns null because $rawState is null.

Return values
State

__construct()

Prevent instantiation — this class is a static namespace only.

private __construct() : mixed
On this page

Search results