mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Fix issue with required parameters in Inspectable containers
An exception is thrown in cases where a constructor parameter is required and has no default value. This will return null for these parameters.
This commit is contained in:
parent
4566318bfb
commit
6bbfd0e885
@ -44,9 +44,10 @@ trait InspectableContainer
|
||||
$passed = [];
|
||||
foreach ($args as $arg) {
|
||||
if ($arg->isOptional()) {
|
||||
$passed[] = $arg->getDefaultValue();
|
||||
continue;
|
||||
}
|
||||
$passed[] = ($arg->getDefaultValue() ?? null);
|
||||
$passed[] = null;
|
||||
}
|
||||
$obj = $reflection->newInstanceArgs($passed);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user