Page MenuHomeDevCentral

BaseCollection::first now returns an Option
ClosedPublic

Authored by dereckson on Nov 7 2025, 01:30.
Tags
None
Referenced Files
F24594029: D3852.diff
Sat, Feb 28, 21:51
F24592534: D3852.id9980.diff
Sat, Feb 28, 20:22
F24592531: D3852.id9979.diff
Sat, Feb 28, 20:22
F24592462: D3852.diff
Sat, Feb 28, 20:20
F24591107: D3852.id9980.diff
Sat, Feb 28, 18:39
F24590839: D3852.id9980.diff
Sat, Feb 28, 18:28
F24589246: D3852.diff
Sat, Feb 28, 16:58
Unknown Object (File)
Fri, Feb 27, 15:34
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