From 9ad2fb9cce8f7f50aa2294377fd2f44848e5c389 Mon Sep 17 00:00:00 2001 From: Martin Rademacher Date: Wed, 8 Jan 2025 11:17:10 +1300 Subject: [PATCH] Lookup processor defaults from constructor instead of class property (#1688) --- tools/src/Docs/ProcGenerator.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/src/Docs/ProcGenerator.php b/tools/src/Docs/ProcGenerator.php index 5a2857a69..de20d9bc2 100644 --- a/tools/src/Docs/ProcGenerator.php +++ b/tools/src/Docs/ProcGenerator.php @@ -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',