Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does @param mean in a class?

Tags:

php

class

param

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;

like image 785
Chris Avatar asked Jan 23 '12 21:01

Chris


People also ask

What does @param mean in code?

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.

What does @param mean in Java?

@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.

Is @param necessary?

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.

What does @param mean in PHP?

The @param tag is used to document a single argument of a function or method.


1 Answers

@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.

like image 58
zzzzBov Avatar answered Oct 04 '22 00:10

zzzzBov