Skip to content

Commit

Permalink
works on my computer
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Feb 17, 2024
1 parent 7e559ae commit b2347fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ReflectionParameterTyped.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function __construct(
}
if ($this->reflection->isDefaultValueAvailable()
&& method_exists($parameter, 'withDefault')
&& $this->reflection->getDefaultValue() !== null
) {
/** @var ParameterInterface $parameter */
$parameter = $parameter
Expand Down
5 changes: 4 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ function reflectionToParameters(ReflectionFunction|ReflectionMethod $reflection)
$reflectType = new ReflectionParameterTyped($reflectionParameter);
$push = $reflectType->parameter();
}
if ($reflectionParameter->isDefaultValueAvailable()) {
if ($reflectionParameter->isDefaultValueAvailable()
&& $reflectionParameter->getDefaultValue() !== null
&& $push->default() === null
) {
try {
$push = $push->withDefault($reflectionParameter->getDefaultValue());
} catch (Throwable $e) {
Expand Down

0 comments on commit b2347fb

Please sign in to comment.