Page MenuHomeDevCentral

BaseCollection::first now returns an Option
ClosedPublic

Authored by dereckson on Nov 7 2025, 01:30.
Tags
None
Referenced Files
F32995291: D3852.id9979.diff
Sun, Jun 14, 02:24
F32995290: D3852.id9980.diff
Sun, Jun 14, 02:24
F32988633: D3852.id9980.diff
Sun, Jun 14, 01:04
Unknown Object (File)
Sat, Jun 13, 01:47
Unknown Object (File)
Wed, Jun 10, 03:57
Unknown Object (File)
Tue, Jun 9, 04:00
Unknown Object (File)
Mon, Jun 8, 08:10
Unknown Object (File)
Fri, Jun 5, 15:33
Subscribers
None

Details

Summary

Previous behavior: return first item or throw an option on empty collection
Current behavior: similar to Rust, return Some(first item) or None

The behavior of BaseCollection::firstOr is not changed, with eager loading.
For lazy loading, we can now use $collection->first()->getValueOrElse().

Test Plan
  • Unit tests have been updated
  • No-op for Zed code (it uses firstOr)

Diff Detail

Repository
rKERUALD Keruald libraries development repository
Lint
Lint Passed
Unit
Tests Passed
Branch
develop/omnitools-1.x
Build Status
Buildable 6154
Build 6438: arc lint + arc unit