final class ClosedList
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Narrows a constructor argument to an ordered list whose items are of one of several admitted classes.

PHP does not check array element types, so every list a constructor accepts passes through here whatever its PHPDoc promises; a list of one class goes through the core check instead.

Methods§

public function of<T of object>(
    array<array-key, object|array<array-key, object|scalar|null>|scalar|null> $items,
    list<class-string<T>> $classes,
    string $message,
    int $minimum = 0,
): ($minimum is positive-int ? non-empty-list<T> : list<T>)

Answers the items as a list, rejecting any item that is of none of the classes, a non-list array, or too few items.

Parameters

$itemsarray<array-key, object|array<array-key, object|scalar|null>|scalar|null>
$classeslist<class-string<T>>
$messagestring
$minimumint

Returns

($minimum is positive-int ? non-empty-list<T> : list<T>)

Throws

InvalidConstruction When the argument is not a list of the admitted classes, or is shorter than the minimum
Test cases 2
Called from 9
Calls 3

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 2

Relations§

Instantiated in 9
Method calls 9