What does the @param mean when creating a class? As far as I understand it is used to tell the script what kind of datatype the variables are and what kind of value a function returns, is that right? For example:
/** * @param string $some * @param array $some2 * @return void */
Isn´t there another way to do that, I am thinking of things like: void function() { ... }
or something like that. And for variables maybe (int)$test;
What Does Parameter (param) Mean? A parameter is a special kind of variable in computer programming language that is used to pass information between functions or procedures. The actual information passed is called an argument.
@param is a special format comment used by javadoc to generate documentation. it is used to denote a description of the parameter (or parameters) a method can receive.
An @param tag is "required" (by convention) for every parameter, even when the description is obvious. The @return tag is required for every method that returns something other than void , even if it is redundant with the method description.
The @param tag is used to document a single argument of a function or method.
@param
doesn't have special meaning in PHP, it's typically used within a comment to write up documentation. The example you've provided shows just that.
If you use a documentation tool, it will scour the code for @param
, @summary
, and other similar values (depending on the sophistication of the tool) to automatically generate well formatted documentation for the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With