closure = $closure instanceof Closure ? $closure : NullClosure::create(); $this->proxies = new HigherOrderMessageCollection(); } /** * Creates the Call. */ public function __destruct() { $proxies = $this->proxies; $this->testSuite->beforeEach->set( $this->filename, ChainableClosure::from(function () use ($proxies): void { $proxies->chain($this); }, $this->closure) ); } /** * Saves the calls to be used on the target. * * @param array $arguments */ public function __call(string $name, array $arguments): self { $this->proxies ->add(Backtrace::file(), Backtrace::line(), $name, $arguments); return $this; } }