public static function mock(string $function): MockedFunction
    {
        $mock = new MockedFunction($function);

        self::$mocks[] = $mock;

        $closure = new ClosureGenerator($function);

        uopz_set_return($function, $closure->generate(), true);

        return $mock;
    }