Valid types available for return and argument types
Type | Description | Minimum PHP Version |
---|---|---|
Class/interface name | The parameter must be an instanceof the given class or interface name. | PHP 5.0.0 |
self | The parameter must be an instanceof the same class as the one the method is defined on. This can only be used on class and instance methods. | PHP 5.0.0 |
array | The parameter must be an array. | PHP 5.1.0 |
callable | The parameter must be a valid callable. | PHP 5.4.0 |
bool | The parameter must be a boolean value. | PHP 7.0.0 |
float | The parameter must be a floating point number. | PHP 7.0.0 |
int | The parameter must be an integer. | PHP 7.0.0 |
string | The parameter must be a string. | PHP 7.0.0 |
iterable | The parameter must be either an array or an instanceof Traversable. | PHP 7.1.0 |
object | The parameter must be an object. | PHP 7.2.0 |
void | The function/method will not return anything. | PHP 7.1.0 |