fromFunctionReflection(new \ReflectionFunction($closure)); } public function __toString(): string { try { return (new Printer)->printClosure($this); } catch (\Throwable $e) { if (PHP_VERSION_ID >= 70400) { throw $e; } trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR); return ''; } } /** * @param Parameter[] $uses * @return static */ public function setUses(array $uses): self { (function (Parameter ...$uses) {})(...$uses); $this->uses = $uses; return $this; } public function getUses(): array { return $this->uses; } public function addUse(string $name): Parameter { return $this->uses[] = new Parameter($name); } }