public static function close(): void
    {
        $mocks = self::$mocks;
        self::$mocks = [];

        foreach ($mocks as $mock) {
            uopz_unset_return($mock->getFunctionName());
        }

        foreach ($mocks as $mock) {
            $function = $mock->getFunctionName();
            $arguments = $mock->getArguments();
            $times = $mock->getExpectedCount();
            $called = $mock->getCalledCount();
            if ($times > $called) {
                throw new ExpectationException("Function {$function}({$arguments}) should be called {$times} times but only called {$called} times");
            }
        }
    }
public static function close(): void
    {
        $mocks = self::$mocks;
        self::$mocks = [];

        foreach ($mocks as $mock) {
            uopz_unset_return($mock->getFunctionName());
        }

        foreach ($mocks as $mock) {
            $function = $mock->getFunctionName();
            $arguments = $mock->getArguments();
            $times = $mock->getExpectedCount();
            $called = $mock->getCalledCount();
            if ($times > $called) {
                throw new ExpectationException("Function {$function}({$arguments}) should be called {$times} times but only called {$called} times");
            }
        }
    }
public static function close ( ) : void { $ mocks = self :: $ mocks ; self :: $ mocks = [ ] ; foreach ( $ mocks as $ mock ) { uopz_unset_return ( $ mock -> getFunctionName ( ) ) ; } foreach ( $ mocks as $ mock ) { $ function = $ mock -> getFunctionName ( ) ; $ arguments = $ mock -> getArguments ( ) ; $ times = $ mock -> getExpectedCount ( ) ; $ called = $ mock -> getCalledCount ( ) ; if ( $ times > $ called ) { throw new ExpectationException ( "Function {$function}({$arguments}) should be called {$times} times but only called {$called} times" ) ; } } }
Finish the mocking, check for any expectations, and restore any mocked functions.

@return void
Finish the mocking check for any expectations and restore any mocked functions .