I am used to using the following generic syntax to define a custom function in a PHP class:
public function my_function(arg1, arg2, ...)
{
//Cuerpo de la función, con o sin retorno
}
I recently saw a piece of code that had a function defined with the following syntax:
public function my_function(arg1, arg2, ...): array
{
//Cuerpo de la función, con o sin retorno
}
I've searched the PHP documentation and googled, and haven't found a clear explanation of what the part : array
in the function declaration does, or why it's there, or anything concrete.
Does anyone know what this is about, or how it works?