/** * Returns the sum of two numbers. * * @param int $a The first number. * @param int $b The second number. * @return int The sum of the two numbers. */ function sum($a, $b) { return $a + $b; }
/** * A class representing a user. */ class User { /** * @var string The user's name. */ public $name; /** * @var int The user's age. */ public $age; /** * Sets the user's name and age. * * @param string $name The user's name. * @param int $age The user's age. */ public function __construct($name, $age) { $this->name = $name; $this->age = $age; } }This example uses a PHP FD comment to describe a class that represents a user by their name and age. The `@var` tags are used to describe the type of each property. The `@param` tag is used to describe the parameters of the constructor. This code could be part of the `UserManagement` package. Overall, PHP FD comments are useful for generating automated documentation for a codebase. They make it easier for developers to understand how functions, classes, and methods work, which can help them write more efficient and maintainable code.