1

If I had a function and I currently was passing in the values all as strings and had it documented something like this:

/**
 * Sends mail using the built-in Swift Mailer component
 * @param string $from The email address who it's from
 * @param string $to The email address who we are sending it to
 * @param string $message The text-based message to send
 * @param string $html_msg The html-based message to send
 * @param string $from_name The name of the person/company it is from
 * @param string $to_name The name/company of the person who we are sending it to
 * @param string $reply_to The reply to email address
 * @return bool true or false if sending succeeded
 */

But instead wanted to pass all the below in a single array, how would I document each key correctly?

2 Answers 2

2

You should declare the param as an array and, eventually you could describe some details inside a code tag. Something like:

/**
 * Sends mail using the built-in Swift Mailer component
 *
 * Example:
 * <code>
 *
 *    $expectedArray = array(
 *        'from' => 'value',
 *        'to'   => 'another value',
 *        ... 
 *    );
 *
 *    yourfunc($expectedArray)
 *
 * </code> 
 *
 * @param array $yourarray an array bla bla... 
 * @return bool true or false if sending succeeded
 */ 
Sign up to request clarification or add additional context in comments.

Comments

0
$email->from = '[email protected]';
$email->to = '[email protected]';

etc

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.