19 declare(strict_types=1);
32 trait CheckClosureTrait
34 private function checkClosureForSignature(
Closure $c,
string $signature): void
36 $error_message =
'first argument and return type of closure must be type-hinted to ' . $signature;
39 if (count(
$r->getParameters()) !== 1) {
42 $first_param_type =
$r->getParameters()[0]->getType();
43 if ($first_param_type instanceof
ReflectionType && $first_param_type->getName() !== $signature) {
46 $return_type =
$r->getReturnType();
47 if ($return_type ===
null) {
50 if ($return_type->getName() !== $signature) {
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null