aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Remote
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2023-12-01 19:25:00 +0100
committerAndreas Gohr <andi@splitbrain.org>2024-01-07 13:41:19 +0100
commitb05603ab331d57d14a1b26cd6b4d540ffe3699e3 (patch)
treeea62f5aaefa211fe9780d628c597cf89958d7b7d /inc/Remote
parente7323dfb8c16f8e36ba21c7a371ef160c99eb1ab (diff)
downloaddokuwiki-b05603ab331d57d14a1b26cd6b4d540ffe3699e3.tar.gz
dokuwiki-b05603ab331d57d14a1b26cd6b4d540ffe3699e3.zip
fix type parsing for more complex types
Diffstat (limited to 'inc/Remote')
-rw-r--r--inc/Remote/ApiCall.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/inc/Remote/ApiCall.php b/inc/Remote/ApiCall.php
index 3d5f192a6..1de44a18b 100644
--- a/inc/Remote/ApiCall.php
+++ b/inc/Remote/ApiCall.php
@@ -283,25 +283,25 @@ class ApiCall
if (isset($tags['param'])) {
foreach ($tags['param'] as $param) {
- if (preg_match('/^(\w+)\s+\$(\w+)(\s+(.*))?$/m', $param, $m)) {
- $result['args'][$m[2]] = [
- 'type' => $this->cleanTypeHint($m[1]),
- 'description' => trim($m[3] ?? ''),
- ];
- }
+ [$type, $name, $description] = array_map('trim', sexplode(' ', $param, 3, ''));
+ if ($name[0] !== '$') continue;
+ $name = substr($name, 1);
+
+ $result['args'][$name] = [
+ 'type' => $this->cleanTypeHint($type),
+ 'description' => $description,
+ ];
}
unset($tags['param']);
}
-
if (isset($tags['return'])) {
$return = $tags['return'][0];
- if (preg_match('/^(\w+)(\s+(.*))?$/m', $return, $m)) {
- $result['return'] = [
- 'type' => $this->cleanTypeHint($m[1]),
- 'description' => trim($m[2] ?? '')
- ];
- }
+ [$type, $description] = array_map('trim', sexplode(' ', $return, 2, ''));
+ $result['return'] = [
+ 'type' => $this->cleanTypeHint($type),
+ 'description' => $description
+ ];
unset($tags['return']);
}