A list of PHP return types which can be used in function arguments, return values and class properties.

Table courtesy of php.net under license.


Type Description Version
Class/interface name The value must be an instanceof the given class or interface.  
self The value must be an instanceof the same class as the one in which the type declaration is used. Can only be used in classes.  
parent The value must be an instanceof the parent of the class in which the type declaration is used. Can only be used in classes.  
array The value must be an array.  
callable The value must be a valid callable. Cannot be used as a class property type declaration.  
bool The value must be a boolean value.  
float The value must be a floating point number.  
int The value must be an integer.  
string The value must be a string.  
iterable The value must be either an array or an instanceof Traversable. PHP 7.1.0
object The value must be an object. PHP 7.2.0
mixed The value can be any value. PHP 8.0.0

Categorized in: