Page MenuHomePhabricator

Add a support class to simplify typechecking list-of-objects return values
ClosedPublic

Authored by epriestley on May 28 2020, 2:30 PM.
Tags
None
Referenced Files
F15419288: D21293.id50707.diff
Fri, Mar 21, 5:01 AM
F15409353: D21293.id50705.diff
Wed, Mar 19, 4:25 AM
F15334366: D21293.diff
Sat, Mar 8, 8:34 AM
Unknown Object (File)
Feb 16 2025, 7:28 PM
Unknown Object (File)
Feb 9 2025, 9:24 AM
Unknown Object (File)
Feb 9 2025, 9:24 AM
Unknown Object (File)
Feb 9 2025, 9:24 AM
Unknown Object (File)
Jan 31 2025, 3:43 PM
Subscribers
None

Details

Summary

With some frequency, code wants to assert that some "$o->m()" returns a list of objects of type X, possibly with unique values for some "getKey()"-style method result.

Existing checks via PhutilTypeMap and assert_instances_of() aren't quite powerful enough to do this while producing an easily understandable error state. We want to know that the error arose from a call to "$o->m()" in particular.

Test Plan

Currently used elsewhere, in Piledriver code.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.May 28 2020, 2:33 PM
This revision was automatically updated to reflect the committed changes.