Stu Mason · Folkestone, Kent
One entryMerged PR· crunch.stumason.dev· PHP

PR #45 merged: fix(pack): numeric spoken keywords crashed segment titling

additions
+19
deletions
-1
files changed
2

A real pack (rollpack-2026-07-03-15-24-05, job qp31JYFd) died at the assemble stage: Segmenter::title(): Return value must be of type string, int returned.

Root cause: PHP coerces numeric-string array keys to ints. A segment with no window/app events falls back to keywords[0] for its title — and when the segment's top spoken token is purely numeric ("402"), array_keys($counts) hands back an int, violating title(): string.

Fix: cast the keyword list back to the declared list<string> at the source (keywords()), so every consumer sees strings. Repro test included (fails with the exact production TypeError before the fix). Full suite green (148).

🤖 Generated with Claude Code