src/S3/BatchDelete.php
private function createPromise()
    {
        // Create the promise
        $promise = call_user_func($this->promiseCreator, $this);
        $this->promiseCreator = null;

        // Cleans up the promise state and references.
        $cleanup = function () {
            $this->before = $this->client = $this->queue = null;
        };

        // When done, ensure cleanup and that any remaining are processed.
        return $promise->then(
            function () use ($cleanup)  {
                return Promise\promise_for($this->flushQueue())
                    ->then($cleanup);
            },
            function ($reason) use ($cleanup)  {
                $cleanup();
                return Promise\rejection_for($reason);
            }
        );
    }
private function createPromise()
    {
        // Create the promise
        $promise = call_user_func($this->promiseCreator, $this);
        $this->promiseCreator = null;

        // Cleans up the promise state and references.
        $cleanup = function () {
            $this->before = $this->client = $this->queue = null;
        };

        // When done, ensure cleanup and that any remaining are processed.
        return $promise->then(
            function () use ($cleanup)  {
                return Promise\promise_for($this->flushQueue())
                    ->then($cleanup);
            },
            function ($reason) use ($cleanup)  {
                $cleanup();
                return Promise\rejection_for($reason);
            }
        );
    }
private function createPromise ( ) { // Create the promise $ promise = call_user_func ( $ this -> promiseCreator , $ this ) ; $ this -> promiseCreator = null ; // Cleans up the promise state and references. $ cleanup = function ( ) { $ this -> before = $ this -> client = $ this -> queue = null ; } ; // When done, ensure cleanup and that any remaining are processed. return $ promise -> then ( function ( ) use ( $ cleanup ) { return Promise \ promise_for ( $ this -> flushQueue ( ) ) -> then ( $ cleanup ) ; } , function ( $ reason ) use ( $ cleanup ) { $ cleanup ( ) ; return Promise \ rejection_for ( $ reason ) ; } ) ; }
Returns a promise that will clean up any references when it completes.

@return PromiseInterface
Returns a promise that will clean up any references when it completes .