Skip to content

Commit

Permalink
Lookup processor defaults from constructor instead of class property (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann authored Jan 7, 2025
1 parent a6eeb59 commit 9ad2fb9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/src/Docs/ProcGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ protected function getOptionsDetails(\ReflectionClass $rc): array
$optiondoc['content'] = $phpdoc['content'];
}

// default is set on the constructor only
$rp = null;
$cc = $rc->getMethod('__construct');
foreach ($cc->getParameters() as $parameter) {
if ($parameter->getName() === $pname) {
$rp = $parameter;
break;
}
}
$default = 'N/A';
if ($rp = $rc->getProperty($pname)) {
if ($rp) {
$dv = $rp->getDefaultValue();
$default = match (gettype($dv)) {
'boolean' => $dv ? 'true' : 'false',
Expand Down

0 comments on commit 9ad2fb9

Please sign in to comment.