PhpDoc icon indicating copy to clipboard operation
PhpDoc copied to clipboard

Default value with a comma (array) creates a bogus @param

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports: a default value that contains a comma (an array such as [1, 2] or array(1, 2)) is split as if it were two parameters, so the generated doc block has a bogus @param.

Steps (Sublime Text build 4200, PhpDoc 2015.12.06): in a .php file:

/**
function f(int $a, array $b = [1, 2], $c = 'x') {}

Put the cursor after /** and complete with the PhpDoc /** entry.

Result:

 * @param int $a 
 * @param array|array $b 
 * @param type 2] 
 * @param type|string $c 

@param type 2] is the second half of [1, 2]. In CodeDoc.py the parameter list is split with group(1).split(','), which does not know about brackets or parentheses.

dpc00 avatar Oct 17 '26 17:10 dpc00