Call at the beginning of the code use Closure; this is the internal class php Closure and then the $ closure variable is used inside the function; From the manual it is absolutely not clear how to work and apply such a variable.
UPD
This is how it uses in the laravel framework, but I don’t understand what they are trying to achieve with this?
public function extend($abstract, Closure $closure) { $abstract = $this->normalize($abstract); if (isset($this->instances[$abstract])) { $this->instances[$abstract] = $closure($this->instances[$abstract], $this); $this->rebound($abstract); } else { $this->extenders[$abstract][] = $closure; } }