Page MenuHomeDevCentral

BaseCollection::first now returns an Option
ClosedPublic

Authored by dereckson on Nov 7 2025, 01:30.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 22, 03:01
Unknown Object (File)
Sun, Nov 15, 00:41
Unknown Object (File)
Thu, Nov 5, 19:15
Unknown Object (File)
Mon, Nov 2, 02:11
Unknown Object (File)
Sun, Nov 1, 20:42
Unknown Object (File)
Sun, Nov 1, 11:18
Unknown Object (File)
Sun, Nov 1, 07:19
Unknown Object (File)
Sat, Oct 31, 11:08
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