1

I tried searching a solution for my problem, but I can't find anything. My problem is that doxygen for php doesn't handle default parameters if they are an array:

Code:

/**
 * @brief convert rgb values to hexa decimal, and return array.
 * @param  int $red   : 0 - 255
 * @param  int $green : 0 - 255
 * @param  int $blue  : 0 - 255
 * @param  array  $default
 * @return array
 */
public static function rgb2hex(
    int   $red   = 0,
    int   $green = 0,
    int   $blue  = 0,
    array $default = ['r' => 0, 'g' => 0, 'b' => 0]
) : array {
...
    return [
        'r' => $r,
        'g' => $g,
        'b' => $b
    ];
}

Rendering:

Doxygen PHP parameter array default values rendering

Screen sample: https://i.stack.imgur.com/bJhiu.png

ouflak
  • 2,458
  • 10
  • 44
  • 49
Jens
  • 84
  • 1
  • 10
  • 1
    Hi Jens, if you think this is a bug, have you considered to check the projects homepage if its already known? – hakre Jul 04 '21 at 06:31
  • Which version of doxygen did you use. Which settings did you use that are different from the default doxygen settings (in the newer versions the result of `doxygen -x`)? – albert Jul 04 '21 at 08:06
  • It looks like doxygen doesn't like the `=>` construct. Best is, when no issue present for this problem at https://github.com/doxygen/doxygen/issues, to file a new issue for this. – albert Jul 04 '21 at 08:20
  • Hi albert, >doxygen -x error: Doxyfile not found and no input file specified! Doxygen version 1.9.1 (ef9b20ac7f8a8621fcfc299f8bd0b80422390f4b) Copyright Dimitri van Heesch 1997-2021 The config i here: https://dpaste.com/FVTHUG56G Sorry for the length, but the wizard seems to be add more comment as requiered. and here is a snippet for a filter: https://dpaste.com/G5238KGVK But I don't realy know, how to use this as input_filter - i would change the php source commenting, but i am very new in doxygen – Jens Jul 04 '21 at 10:17
  • @Jens I missed this comment at first. In the doxygen wizard on the run page you can also see the used configuration and also the condensed form (this should be the same as the normal `doxygen -x Doxyfile`) – albert Jul 05 '21 at 08:42
  • I've just pushed a proposed patch to github (pull request 8673, https://github.com/doxygen/doxygen/pull/8673). – albert Jul 15 '21 at 14:05
  • 1
    Code has been integrated in master on github – albert Jul 16 '21 at 08:55

1 Answers1

1

doxygen 1.9 2021 does not understand PHP array = [ ];,

A workaround is by using old school: array = ( );

Note: see the difference between [ ], and array = ( );

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Jens
  • 84
  • 1
  • 10
  • Probably your pointer (`(` <=> `[`) is better than mine. You mention version `doxygen 1.9 2021`, which version is this ? I only know at the moment, for the 1.9 series, the doxygen versions `1.9.0` and `1.9.1` and further the current master `(1.9.2 (7fa3837cf2d93164df2cf2fc6697a27fea524d07)`, with the master the git ID, as reported by `doxygen -v`, should always be specified). – albert Jul 04 '21 at 16:06
  • 1
    I've just pushed a proposed patch to github (pull request 8673, https://github.com/doxygen/doxygen/pull/8673). – albert Jul 15 '21 at 14:05
  • 1
    Code has been integrated in master on github – albert Jul 16 '21 at 08:55