Skip to content

Commit 63dd3e9

Browse files
authored
Merge pull request #27 from akirk/fix/clean-array-param-output
2 parents a315dd5 + 91d01e1 commit 63dd3e9

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

class-wphookextractor.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function extract_vars( $params, $tokens, $i ) {
145145
$vars = array( '' );
146146
$signature = $tokens[ $i ][1];
147147
$line = $tokens[ $i ][2];
148-
$search_window = 50;
148+
$search_window = 100;
149149
for ( $j = $i + 1; $j < $i + $search_window; $j++ ) {
150150
if ( ! isset( $tokens[ $j ] ) ) {
151151
break;
@@ -686,19 +686,24 @@ public function create_documentation_content( $hooks, $github_blob_url ) {
686686
// Determine if this parameter should be optional (not used consistently across all files).
687687
$is_optional = $i >= $consistent_param_count;
688688

689+
// Strip trailing { from array parameter descriptions (WordPress documentation style).
690+
if ( isset( $p[2] ) ) {
691+
$p[2] = rtrim( $p[2], ' {' );
692+
}
693+
689694
if ( 'unknown' === $p[0] ) {
690695
$params .= "\n- `{$p[1]}`";
691696
if ( $is_optional ) {
692697
$signature_params[] = $p[1] . ' = null';
693698
} else {
694699
$signature_params[] = $p[1];
695700
}
696-
if ( isset( $p[2] ) ) {
701+
if ( ! empty( $p[2] ) ) {
697702
$params .= ' ' . $p[2];
698703
}
699704
} else {
700705
$params .= "\n- *`{$p[0]}`* `{$p[1]}`";
701-
if ( isset( $p[2] ) ) {
706+
if ( ! empty( $p[2] ) ) {
702707
$params .= ' ' . $p[2];
703708
}
704709
if ( substr( $p[0], -5 ) === '|null' || $is_optional ) {

0 commit comments

Comments
 (0)