Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 531 Bytes

instance_of.md

File metadata and controls

27 lines (18 loc) · 531 Bytes

instance_of

Description

Returns a checker that validated if an $element is an instance of a $className

Parameters

className
Class name to compare with.

Examples

Check if all the elements of a collection are instances of a Exception

<?php

use function Lambdish\Phunctional\all;
use function Lambdish\Phunctional\instance_of;

$coll = [new Exception(), new InvalidArgumentException(), new Exception()];

return all(instance_of(Exception::class), $coll);

// => true