HomePhabricator

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

Description

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

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.

Differential Revision: https://secure.phabricator.com/D21293