DeclaredCondition
One condition an operation DECLARES about itself — a named precondition or postcondition. It exists so a caller can ask «what should happen?» before executing and «did it?» after, without a model inventing either answer: the operation states its conditions once, as data, and every surface reads the same statement. It is deliberately just {name, description}, because this value object is the DECLARATION and never the proof: the truth of a precondition lives in the handler that refuses when it is violated, and the truth of a postcondition lives in the verifier that checks it after the run. A package that declares a condition owes the test tying the declared name to that enforcement — declaring what nothing enforces is the lie this shape makes checkable.
DeclaredCondition::__construct()
public function __construct(string $name, string $description):Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | stable identifier of the condition, the same name the handler's refusal or the verifier's report uses (e.g. `entity_file`, `phpunit-installed`) |
| $description | string | what must hold, in one line a human or an agent can read |
DeclaredCondition::toArray()
public function toArray(): arrayThe condition as data — the shape a surface projects and a contract reader returns.
DeclaredCondition::fromArray()
public static function fromArray(array $data): selfThe inverse of {@see self::toArray()}: a condition back from the array a consumer stored. Both keys are required and must be strings — a partial array is not a declaration, and reading one as if it were would turn «nobody declared this» into «somebody declared something» silently.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> | as produced by toArray() |