Skip to content

re #96 specify generics on Structure consumers#107

Merged
tonydspaniard merged 1 commit into
masterfrom
feat/96-consumer-generics
May 28, 2026
Merged

re #96 specify generics on Structure consumers#107
tonydspaniard merged 1 commit into
masterfrom
feat/96-consumer-generics

Conversation

@tonydspaniard
Copy link
Copy Markdown
Member

Follow-on to the Structure generics (#106): declares generic args on the collection subclasses/usages across consumer packages, clearing the "does not specify its types" findings that the generic base types created. Baseline phpstan-baseline.neon: 111 → 72 (−39). PHPDoc-only, runtime-safe (full suite unaffected). Done as 4 parallel per-package passes.

Package What
Container @extends Map<…> on Aliases/ClassDefinitions/ParameterDefinitions/Prepares/Delegates/Shares collections
Http RouteCollection @extends Map<string,string>; Input/Settings Map<string,mixed>; MiddlewareCollection Queue<mixed>; HttpStatusCollection @implements IteratorAggregate<int,string>
Validation / Sanitation Rule/FilterCollection @extends Map<string,mixed>; runners Queue<mixed>
Messaging TransportFactoryInterface<TransportInterface> args
Courier MessageCommandMap @extends Map<string, class-string<CommandInterface>|CommandInterface>
Persistence $repository @var CycleRepository<TEntity>
Middleware / Configuration Queue<mixed> / Set<class-string|ConfigurationInterface>

Cookie — surfaced a real issue, left it (correctly)

Fixed the VectorInterface arity (it's single-TValue, was wrongly <int, ?string>) and Pair<string, Cookie> args. Did not add the class-level @extends Map<string, Cookie>: doing so exposes 6 genuine pre-existing Liskov violationsCookieCollection::put() takes ?string (the cookie value), not Cookie, so it isn't really a Map<string, Cookie>. PHPDoc can't fix a native-signature divergence; it's a real design issue, out of scope for a generics pass, so it stays baselined and is flagged for follow-up. (The agent stopped and surfaced this per CLAUDE.md §5 rather than forcing a wrong type or adding 6 new errors.)

Gates

composer stan green (72 baselined, 0 live), CS clean, rector --dry-run clean (after applying the cleanups the new args unlocked). Full suite at the 5 pre-existing ext-mongodb/ext-memcached environmental errors — no regressions.

Part of #96. Progress: 719 → 72 (90% cleared). Remaining 72 are genuine code-quality/subtype findings (unsafe new static, third-party class-not-found, PSR/Liskov conflicts like the Cookie one) needing individual fixes — then raise level 6 → 7 → 8.

Declares generic args on the collection subclasses/usages across consumer
packages, now that univeros/structure is generic. Baseline 111 -> 72 (-39).
PHPDoc-only; runtime-safe; full suite unaffected.

- Container: @extends Map<...> on Aliases/ClassDefinitions/Parameter
  Definitions/Prepares/Delegates/Shares collections; SharesCollection
  @return MapInterface<string, object|null>.
- Http: @extends Map<string,string> RouteCollection; Map<string,mixed>
  Input/Settings collections; Queue<mixed> MiddlewareCollection;
  HttpStatusCollection @implements IteratorAggregate<int,string>.
- Validation/Sanitation: @extends Map<string,mixed> Rule/FilterCollection;
  Queue<mixed> runners.
- Messaging: TransportFactoryInterface<TransportInterface> args.
- Courier: MessageCommandMap @extends Map<string, class-string<CommandInterface>|CommandInterface>.
- Persistence: $repository @var CycleRepository<TEntity>.
- Middleware/Configuration: Queue<mixed> / Set<class-string|ConfigurationInterface>.
- Cookie: fixed VectorInterface arity (single TValue) + Pair<string,Cookie>
  args. Left the class-level @extends Map<string,Cookie> OFF: it surfaces
  6 genuine pre-existing Liskov violations (CookieCollection::put takes
  ?string, not Cookie) that PHPDoc can't fix — a real design issue, out of
  scope here (stays baselined, flagged for follow-up).

Rector then applied configured-set cleanups the new args unlocked. stan /
cs / rector --dry-run green; full suite at the 5 pre-existing ext-mongodb
environmental errors. #96 now 719 -> 72 (90% cleared). Remaining: genuine
code-quality/subtype findings (unsafe new static, third-party class-not-found,
PSR/Liskov conflicts) needing individual fixes, then raise level 6 -> 8.
@tonydspaniard tonydspaniard merged commit 1dee1c1 into master May 28, 2026
3 checks passed
@tonydspaniard tonydspaniard deleted the feat/96-consumer-generics branch May 28, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant