Reference

Revision methods

The methods IsRevision gives your enum, and the

Ark4ne\ApiRevisions\Revisions\Revision is the interface of your enum; the trait Ark4ne\ApiRevisions\Revisions\IsRevision implements it, except order(). Cases are compared by their place in order(), never by declaration order.

Methods

MethodReturns
static order(): arrayevery case, oldest first; the last is the head (written by you)
isBefore(Revision $other): boolstrictly older than $other
isAfter(Revision $other): boolstrictly newer than $other
isAtMost(Revision $other): bool$other or older
isAtLeast(Revision $other): bool$other or newer
previous(): ?staticthe previous case in order(), null for the oldest
next(): ?staticthe next case in order(), null for the head
static latest(): staticthe head
static oldest(): staticthe oldest revision
static current(): staticthe revision of the running request, or of the innermost using()
static using(Revision $revision, Closure $callback): mixedruns the callback with $revision current, returns what it returns
meta(): Metathe case's #[Meta], an empty one when none

#Meta

#[Meta(
    string $description = '',
    ?string $publishedAt = null,
    ?string $deprecatedAt = null,
    ?string $sunsetAt = null,
)]

On a case of the enum. Days are Y-m-d.

description
string
Heads the revision in the changelog and the $comment of the export.
publishedAt
string|null
Shown in the changelog and the export.
deprecatedAt
string|null
Sends Deprecation: @<unix time> (RFC 9745) on every response in this revision.
sunsetAt
string|null
Sends Sunset: <HTTP date> on every response in this revision.

Meta::isDeprecated(DateTimeInterface $now) and Meta::isSunset(DateTimeInterface $now) tell whether the day is reached. #[Meta] never changes behaviour.