1: <?php declare(strict_types=1);
2:
3: namespace TH\Maybe\Internal;
4:
5: /**
6: * Check if the type of the given value is any of the passed classes.
7: *
8: * @template T
9: * @param iterable<class-string<T>> $classes
10: * @psalm-assert-if-false !T $value
11: * @psalm-assert-if-true T $value
12: */
13: function isOfAnyClass(
14: object $value,
15: iterable $classes,
16: ): bool {
17: foreach ($classes as $class) {
18: if (\is_a($value, $class)) {
19: return true;
20: }
21: }
22:
23: return false;
24: }
25: