Skip to content

Commit 611360b

Browse files
committed
use Assert all ReflectionNamedType under ReflectionUnionType and ReflectionIntersectionType
1 parent 0ca6d89 commit 611360b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Assert/Filter.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use ReflectionMethod;
1212
use ReflectionNamedType;
1313
use ReflectionUnionType;
14+
use Webmozart\Assert\Assert;
1415

1516
use function array_map;
1617
use function gettype;
@@ -36,8 +37,10 @@ public static function boolean(callable $filter): void
3637

3738
if ($returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType) {
3839
$separator = $returnType instanceof ReflectionUnionType ? '|' : '&';
39-
/** @var ReflectionNamedType[] $types */
40-
$types = $returnType->getTypes();
40+
$types = $returnType->getTypes();
41+
42+
Assert::allIsInstanceOf($types, ReflectionNamedType::class);
43+
4144
throw new InvalidArgumentException(
4245
sprintf(
4346
'Expected a bool return type on callable filter, %s given',

0 commit comments

Comments
 (0)