Compat
in package
The version discipline check (DXNS.md ยง8), mirroring `Dextrin.Schema.Compat`: compares the schemas of a previous release with the current ones.
- A schema whose content changed must have a new version: a version
present in both whose fields differ -- a field added, removed,
moved, or one whose type, requiredness or default changed -- is a
problem, because two documents claiming to be
Userv3 must mean the same thing. - A version never goes down.
- Informational: for each schema, every older version still loaded beside the latest, with the fields the latest added, removed and changed since -- a checklist for the materializer's branches.
There are no compatibility modes and no append-only rule. A field's description is documentation, not content.
Tags
Table of Contents
Methods
- check() : Upgrade>}
- `$old`'s schemas against `$new`'s: the problems, and the upgrade checklist for `$new`, each sorted by schema name and version.
- __construct() : mixed
- fieldShape() : string
- A field's requiredness, type and default, as one string compared strictly -- `serialize`, because `==` on the objects a type or a default holds is PHP's loose comparison, under which `1` and `true` would be the same default.
- problems() : array<int, Problem>
- shape() : string
- What a schema's content is, for this check: its fields in order.
- sorted() : array<string|int, mixed>
- `$map` sorted by key: names (identifiers, never numeric) as strings, versions as numbers -- `SORT_STRING` would put 10 before 2.
- upgrade() : Upgrade
- upgrades() : array<int, Upgrade>
Methods
check()
`$old`'s schemas against `$new`'s: the problems, and the upgrade checklist for `$new`, each sorted by schema name and version.
public
static check(Registry $old, Registry $new) : Upgrade>}
Parameters
Return values
Upgrade>}__construct()
private
__construct() : mixed
fieldShape()
A field's requiredness, type and default, as one string compared strictly -- `serialize`, because `==` on the objects a type or a default holds is PHP's loose comparison, under which `1` and `true` would be the same default.
private
static fieldShape(Field $field) : string
Parameters
- $field : Field
Return values
stringproblems()
private
static problems(array<string|int, mixed> $before, array<string|int, mixed> $now) : array<int, Problem>
Parameters
- $before : array<string|int, mixed>
- $now : array<string|int, mixed>
Return values
array<int, Problem>shape()
What a schema's content is, for this check: its fields in order.
private
static shape(Compiled $compiled) : string
Parameters
- $compiled : Compiled
Return values
stringsorted()
`$map` sorted by key: names (identifiers, never numeric) as strings, versions as numbers -- `SORT_STRING` would put 10 before 2.
private
static sorted(array<string|int, mixed> $map) : array<string|int, mixed>
Parameters
- $map : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>upgrade()
private
static upgrade(string $name, int $from, Compiled $older, int $to, Compiled $latest) : Upgrade
Parameters
Return values
Upgradeupgrades()
private
static upgrades(array<string|int, mixed> $now) : array<int, Upgrade>
Parameters
- $now : array<string|int, mixed>