PhpDoc icon indicating copy to clipboard operation
PhpDoc copied to clipboard

Type hint plus default writes the type twice (array|array)

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports: when a parameter has both a type hint and a default value, the type is written twice: @param array|array $b.

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

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

Complete the doc block with the PhpDoc /** entry.

Result: * @param array|array $b. Expected: * @param array $b.

In expandPhpFunction a type taken from the hint (array) gets | appended when there is a default value, and then the type guessed from the default (array) is added after it, without checking that they are the same.

dpc00 avatar Oct 17 '26 17:10 dpc00