diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-06 20:04:25 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-06 20:04:25 +0900 |
| commit | 3f525f228052ad04e6f9da6ff160bef803d079bd (patch) | |
| tree | 3fe2d078e6a30b12ce041b1b3f1e589bc47cf8f3 /crates/shirabe-semver/src/constraint/any_constraint.rs | |
| parent | d9dca94603766712b5989ea8169c9e286d27a60c (diff) | |
| download | php-shirabe-3f525f228052ad04e6f9da6ff160bef803d079bd.tar.gz php-shirabe-3f525f228052ad04e6f9da6ff160bef803d079bd.tar.zst php-shirabe-3f525f228052ad04e6f9da6ff160bef803d079bd.zip | |
feat(plugin): let links and release dates cross the RPC boundary
The link getters and setters and the release date accessors were explicit
errors for every non-empty value, because an immutable value has no entity
to point a handle at. They now cross as materialized values: the descriptor
names the real class and the constructor arguments, and each side builds a
genuine instance of its own.
The semver constraint a link holds is encoded structurally rather than
re-parsed from its string form, so the pretty strings and the conjunctive
flag survive the crossing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-semver/src/constraint/any_constraint.rs')
| -rw-r--r-- | crates/shirabe-semver/src/constraint/any_constraint.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/shirabe-semver/src/constraint/any_constraint.rs b/crates/shirabe-semver/src/constraint/any_constraint.rs index b61a36fb..37541deb 100644 --- a/crates/shirabe-semver/src/constraint/any_constraint.rs +++ b/crates/shirabe-semver/src/constraint/any_constraint.rs @@ -118,6 +118,19 @@ impl AnyConstraint { matches!(self, Self::MatchNone(_)) } + /// The pretty string as stored, without the `getPrettyString()` fallback to the + /// constraint's string form. PHP has no such reader — `$prettyString` is protected — so + /// this exists for callers that must round-trip a constraint without inventing a value + /// for the unset case. + pub fn pretty_string(&self) -> Option<&str> { + match self { + Self::Simple(c) => c.pretty_string.as_deref(), + Self::Multi(c) => c.pretty_string.as_deref(), + Self::MatchAll(c) => c.pretty_string.as_deref(), + Self::MatchNone(c) => c.pretty_string.as_deref(), + } + } + /// PHP exposes `ConstraintInterface::setPrettyString()` and defaults the /// pretty string to the constraint's string form when unset. This port takes /// the pretty string at construction instead; this setter exists only so |
