Linia 3: use Closure; – importuje, żeby niżej móc pisać Closure zamiast \Closure (przestrzenie nazw)
Linia 50: Closure $queueResolver = null) – w konstruktorze przyjmuje funkcję anonimową jako argument – Closure jest tu po to, żeby umożliwić http://php.net/manual/en/language.oop5.typehinting.php – czyli upewnienie się, że przekazano argument właśnie z funkcją anonimową, a nie np
https://github.com/laravel/framework/blob/master/src/Illuminate/Bus/Dispatcher.php
#php #laravel
Linia 3:
use Closure;– importuje, żeby niżej móc pisaćClosurezamiast\Closure(przestrzenie nazw)Linia 50:
Closure $queueResolver = null)– w konstruktorze przyjmuje funkcję anonimową jako argument –Closurejest tu po to, żeby umożliwić http://php.net/manual/en/language.oop5.typehinting.php – czyli upewnienie się, że przekazano argument właśnie z funkcją anonimową, a nie npDisplatchera, robisz np:$queueResolver = function () { /* whatever */ };$dispatcher = new \Illuminate\Bus\Dispatcher($container, $queueResolver);
$dispatcher->dispatchToQueue($command); // tu zostanie użyta funkcja anonimowa (closure)