Understanding callbacks used in Collection classes method as described in the cookbook

I am currently working through the CakePHP Cookbook. Doing so, i stumbled across Collection and its methods. Almost every method is given a callable calback function as a parameter. In the Cookbook there are some examples.

This example from the Cookbook makes totally sense for me as there is a callback function that has two parameters which both are used in the function itself:

$collection = $collection->each(function ($value, $key){
echo "Elemement $key: $value;
});

Meanwhile I do not understand this example (chapter “Collections, Quick Example”)

$overOne = $collection->filter(function ($value, $key, $iterator){
return $value > 1;
});

Why does this function require three parameters of which two are not used? Where is the number of parameters for callback function defined?

There are more examples of callback functions that do have parameters that are not used so I guess this is no mistake but I cannot find any description about that topic in the Cookbook…

The second example is a very simple one, just filtering on the value, so that’s the only variable that’s needed. Quite easy to think of situations where you might need to filter on the key instead, or both the key and value, etc. The callback interfaces are defined in such a way that you’ll be able to do everything you might ever need to with it.