Skip to content

Commit 532e24d

Browse files
committed
Bring Symbols enum and module-base docs back in line with reality
Three small consistency fixes surfaced by a code-review pass: - Symbols::Birth comment said "asterisk" but the value is BLACK STAR (★, U+2605). Update the comment so a future reader doesn't switch to a literal "*" and silently change the rendered glyph. - MARRIAGE_DATE_UNKNOWN was a `public const string` on a backed enum while every other entry is a real case, forcing consumers to drop ->value at the one call site. Promote it to `case MarriageDateUnknown` so cases() / from() / value access stay uniform; updated the single upstream consumer (DateProcessor) to use ->value. - README.md and AGENTS.md still advertised Model/Node + Model/NodeData even though those classes only live inside the chart-module repos and were never part of module-base. Replace with the actual public surface (Symbols enum + NameAbbreviation strategy enum). Sister AGENTS.md files in the three chart modules were sed-fixed for the matching MarriageDateUnknown rename in their respective repos.
1 parent 470427c commit 532e24d

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Overview
2-
This repository hosts `magicsunday/webtrees-module-base` — a shared PHP library consumed by `webtrees-fan-chart`, `webtrees-pedigree-chart`, and `webtrees-descendants-chart`. It contains the common processors (Date, Name, Image, Place), models (Node, Symbols), and module helpers (VersionInformation) those modules use to render genealogy charts. No JavaScript, no asset pipeline — pure PHP.
2+
This repository hosts `magicsunday/webtrees-module-base` — a shared PHP library consumed by `webtrees-fan-chart`, `webtrees-pedigree-chart`, and `webtrees-descendants-chart`. It contains the common processors (Date, Name, Image, Place), models (Symbols, NameAbbreviation), and module helpers (VersionInformation) those modules use to render genealogy charts. No JavaScript, no asset pipeline — pure PHP.
33

44
## Setup/env
55
- PHP 8.3 - 8.5 with extension `dom` is required; composer installs dependencies into `.build/vendor` and binaries into `.build/bin`.
@@ -39,8 +39,8 @@ tests/
3939
- **`PlaceProcessor`** — place name shortening (configurable parts) for chart labels.
4040

4141
### Models
42-
- **`Model/Symbols`** — backed enum for genealogical symbols (Birth ★, Death †, etc.) plus the `MARRIAGE_DATE_UNKNOWN` sentinel.
43-
- **`Model/Node`, `Model/NodeData`**used by chart modules for tree-node serialization to D3 (each module wraps these in its own DataFacade).
42+
- **`Model/Symbols`** — backed enum for genealogical symbols (Birth ★, Death †, en-dash separator, MarriageDateUnknown sentinel).
43+
- **`Model/NameAbbreviation`**backed enum + `resolve()` helper for the chart-label name-abbreviation strategy (auto / given / surname). Each chart module wires its own NodeData class; this base library only ships the strategy enum.
4444

4545
### Modules
4646
- **`Module/VersionInformation`** — checks GitHub releases for newer module versions, with file cache. Used by all three chart modules' admin pages.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class Module extends AbstractModule implements ModuleCustomInterface, ModuleAsse
5151
- **`PlaceProcessor`** — place name shortening (configurable parts) for chart labels
5252

5353
### `src/Model/`
54-
- **`Symbols`** — backed enum for genealogical symbols (Birth ★, Death †, MARRIAGE_DATE_UNKNOWN sentinel, …)
55-
- **`Node`, `NodeData`**tree-node value objects with D3-friendly JSON serialisation, used by chart modules' `DataFacade`
54+
- **`Symbols`** — backed enum for genealogical symbols (Birth ★, Death †, en-dash separator, MarriageDateUnknown sentinel)
55+
- **`NameAbbreviation`**backed enum + `resolve()` helper for the name-abbreviation strategy used in chart labels (auto / given-first / surname-first)
5656

5757
### `src/Module/`
5858
- **`VersionInformation`** — checks GitHub releases for newer module versions, with file cache (used by the chart modules' admin pages)

src/Model/Symbols.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
enum Symbols: string
2222
{
2323
/**
24-
* Birth symbol (asterisk).
24+
* Birth symbol (black star).
2525
*/
2626
case Birth = "\u{2605}";
2727

@@ -40,5 +40,5 @@ enum Symbols: string
4040
* Consumers that render the marriage symbol can check for this sentinel
4141
* to display the symbol without an accompanying date string.
4242
*/
43-
public const string MARRIAGE_DATE_UNKNOWN = '?';
43+
case MarriageDateUnknown = '?';
4444
}

src/Processor/DateProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public function getFormattedMarriageDate(): string
284284

285285
/**
286286
* Returns the marriage date of the parents formatted with the generation-aware
287-
* compact format. Returns Symbols::MARRIAGE_DATE_UNKNOWN ("?") when a MARR fact
287+
* compact format. Returns Symbols::MarriageDateUnknown ("?") when a MARR fact
288288
* exists but carries no date, so consumers can distinguish "married, date unknown"
289289
* from "no marriage fact at all". Empty string when no parent family exists.
290290
*
@@ -300,7 +300,7 @@ public function getFormattedMarriageDateOfParents(): string
300300
}
301301

302302
if (($family !== null) && $family->facts(['MARR'])->isNotEmpty()) {
303-
return Symbols::MARRIAGE_DATE_UNKNOWN;
303+
return Symbols::MarriageDateUnknown->value;
304304
}
305305

306306
return '';

0 commit comments

Comments
 (0)