Skip to content

Commit

Permalink
ReflectionSourceStubber - do not make optional parameter without defa…
Browse files Browse the repository at this point in the history
…ult value available nullable
  • Loading branch information
ondrejmirtes committed May 24, 2022
1 parent b90e741 commit 4495bf1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SourceLocator/SourceStubber/ReflectionSourceStubber.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ private function setParameterDefaultValue(ReflectionParameter $parameterReflecti
}

if (! $parameterReflection->isDefaultValueAvailable()) {
$parameterNode->setDefault(null);
if ($parameterReflection->allowsNull()) {
$parameterNode->setDefault(null);
} else {
$parameterNode->setDefault(new Node\Expr\ConstFetch(new FullyQualified('UNKNOWN')));
}

return;
}
Expand Down

0 comments on commit 4495bf1

Please sign in to comment.