Typehinting array of models

I was wondering if you can typehint an array of models in php (more explicitly Laravel).

A code example:

use AppUser;

public function index(User $user)
{
    // do something with the user
}

My question is, is there a way to typehint an array of User models:

use AppUser;

public function index(array User $users) //this is wrong ..
{
    // do something with the users
}

Answer

No, you can’t do this. The best you can do is to typehint the parameter as an array. You can read more about type-hinting in PHP here: http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration

UPDATE In PHP 5.6+ you can use variable length argument lists to achieve what you want. Check the answer below