re #96 specify generics on Structure consumers#107
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.@extends Map<…>on Aliases/ClassDefinitions/ParameterDefinitions/Prepares/Delegates/Shares collectionsRouteCollection@extends Map<string,string>; Input/SettingsMap<string,mixed>;MiddlewareCollectionQueue<mixed>;HttpStatusCollection@implements IteratorAggregate<int,string>Rule/FilterCollection@extends Map<string,mixed>; runnersQueue<mixed>TransportFactoryInterface<TransportInterface>argsMessageCommandMap@extends Map<string, class-string<CommandInterface>|CommandInterface>$repository@var CycleRepository<TEntity>Queue<mixed>/Set<class-string|ConfigurationInterface>Cookie — surfaced a real issue, left it (correctly)
Fixed the
VectorInterfacearity (it's single-TValue, was wrongly<int, ?string>) andPair<string, Cookie>args. Did not add the class-level@extends Map<string, Cookie>: doing so exposes 6 genuine pre-existing Liskov violations —CookieCollection::put()takes?string(the cookie value), notCookie, so it isn't really aMap<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 stangreen (72 baselined, 0 live), CS clean, rector--dry-runclean (after applying the cleanups the new args unlocked). Full suite at the 5 pre-existingext-mongodb/ext-memcachedenvironmental 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.