0

I would like to properly document a PHP 8.2 inline callable's output for an array of strings.

here's an example:

/** @var callable $params : Array<string> */
$params = fn() : array => array_map(
    $format(...),
    [
        $fieldId,
        $matchType->name,
        $value,
    ]
);

assuming $format(...) always returns a string, is this the correct syntax?

Shawn Naquin
  • 73
  • 10

1 Answers1

0

PHP Doc Syntax @var ["Type"] [element_name] [<description>]

Doesn't cover return values.. also your example has no parameters so there's no way of giving you a complete answer..

/**
 * Summary.
 * Description.
 *
 * @return string[] $params An array of modified strings.
 */

try including more information, like a working example, not just a half thought abstraction that works in theory in your head.

yarns
  • 66
  • 8