Skip to content

feat(support): bring Collection/Arr to L13 shape (task 3.3b) - #38

Open
agissept wants to merge 1 commit into
migration/3.3-support-collection-scc1from
migration/3.3b-collection-l13
Open

feat(support): bring Collection/Arr to L13 shape (task 3.3b)#38
agissept wants to merge 1 commit into
migration/3.3-support-collection-scc1from
migration/3.3b-collection-l13

Conversation

@agissept

Copy link
Copy Markdown
Member

Stacked on #37 (task 3.3a). Completes Wave 1 — the fork's Collection surface now matches Laravel 13, so the app can start exercising L13 Collection idioms.

What

Copy the v13 collection-family into the fork's Support tree, sourced verbatim from the clean v13.30.1 tag (git show) — not the local ../framework working tree (it sits on an inconsistent merge branch).

New: Enumerable, Traits/EnumeratesValues, LazyCollection, HigherOrderCollectionProxy, Item/MultipleItemsFoundException, functions.php (enum_value), Contracts/Support/CanBeEscapedWhenCastToString, and a minimal SortDirection enum (v13 references it from Collection::sort*() but ships no defining file — dangling even upstream; only ::Ascending/::Descending are ever used).

Deliberate deviations from verbatim copy

Reconciliation

  • Arr (kept, not replaced — first/last already v13 value-first): add from/mapWithKeys/partition/select; flip Arr::where to v13 value-first (ARRAY_FILTER_USE_BOTH) and fix its whereNotNull + UrlGenerator callers.
  • Eloquent\Collection (only subclass): widen contains()/unique() and delegate the v13 args to parent::; drop the redundant max()/min() overrides (base v13 handles model collections via data_get).
  • Tests updated to v13 semantics (immutable sort, key-preserving chunk/takeLast, keys()→Collection, random-on-empty throws, toJson via jsonSerialize, offsetExists via isset).
  • MorphTo::gatherKeysByType gets ->values() for v13 map key-preservation.

⚠️ For app integration

v13 Collection::map preserves keys where 4.2 reindexed. Only one fork site surfaced (MorphTo, fixed). App code that assumes map() reindexes may silently produce keyed arrays — worth watching when you wire this fork into the app. Broader app sweep is a separate deferred task.

Verification

  • Full fork suite green: 1641 passed, 0 failures.
  • SCC-1 stays broken (grep Support→Http/Container concrete = 0).
  • Convergence ratchet tightened: macroable_trait 14→12, legacy_contracts 50→37.

🤖 Generated with Claude Code

Copy the v13 collection-family into the fork's Support tree so the
Collection surface matches Laravel 13, sourced verbatim from the clean
v13.30.1 tag (git show) — NOT the local ../framework working tree, which
sits on an inconsistent merge branch.

New files: Enumerable, Traits/EnumeratesValues, LazyCollection,
HigherOrderCollectionProxy, Item/MultipleItemsFoundException, functions.php
(enum_value), Contracts/Support/CanBeEscapedWhenCastToString, and a minimal
SortDirection enum reconstructed because v13 references it from
Collection::sort*() but ships no defining file.

Two deliberate deviations from verbatim copy:
- strip `TransformsToResourceCollection` from Collection — it pulls in
  Http\Resources and would undo the SCC-1 decoupling from task 3.3a.
- keep the 4.2 holdovers the fork's Database layer still calls
  (Collection::lists()/fetch(), Arr::build()/fetch()); removed in task 2.5.

Arr: keep the fork class (first/last already v13 value-first), add
from/mapWithKeys/partition/select, and flip Arr::where to v13 value-first
semantics (fix its whereNotNull + UrlGenerator callers).

Eloquent\Collection (only Collection subclass): widen contains()/unique()
and delegate the v13 args to parent; drop the now-redundant max()/min()
overrides (base v13 handles model collections via data_get).

Update SupportCollectionTest/SupportArrTest assertions to v13 semantics
(immutable sort, key-preserving chunk/takeLast, keys()->Collection,
random-on-empty throws, toJson via jsonSerialize, offsetExists via isset)
and MorphTo::gatherKeysByType (->values()) for v13 map key-preservation.

Full suite green (1641); SCC-1 stays broken; ratchet baseline tightened
(macroable_trait 14->12, legacy_contracts 50->37).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agissept
agissept force-pushed the migration/3.3b-collection-l13 branch from d2abb75 to d35a07b Compare September 11, 2026 09:29
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