Skip to content

Commit

Permalink
support php 8.0 ReflectionUnionType methon parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaleta committed Feb 3, 2022
1 parent 110bf3a commit 2d88616
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Hydrator/ReadOnlyHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,14 @@ protected function getPhpForMethod(\ReflectionMethod $reflectionMethod, array $p
protected function getPhpForParameter(\ReflectionParameter $parameter)
{
$types = $parameter->getType();
if($types !== null && get_class($types) === "ReflectionUnionType") {
if($types === null) {
$types = [];
} elseif(get_class($types) === "ReflectionUnionType") {
$types = $types->getTypes();
} else {
$types = [$types];
}

$values = [];
$hasNull = false;
$needsNull = false;
Expand Down

0 comments on commit 2d88616

Please sign in to comment.