src/Promise.php
protected static function rejectFunction(self &$target)
    {
        return function ($reason = null) use (&$target) {
            if ($target !== null) {
                $target->reject($reason);
                $target = null;
            }
        };
    }
protected static function rejectFunction(self &$target)
    {
        return function ($reason = null) use (&$target) {
            if ($target !== null) {
                $target->reject($reason);
                $target = null;
            }
        };
    }
protected static function rejectFunction ( self & $ target ) { return function ( $ reason = null ) use ( & $ target ) { if ( $ target !== null ) { $ target -> reject ( $ reason ) ; $ target = null ; } } ; }
Creates a static rejection callback that is not bound to a promise instance.

Moving the closure creation to a static method allows us to create a
callback that is not bound to a promise instance. By passing the target
promise instance by reference, we can still execute its rejection logic
and still clear this reference when settling the promise. This helps
avoiding garbage cycles if any callback creates an Exception.

These assumptions are covered by the test suite, so if you ever feel like
refactoring this, go ahead, any alternative suggestions are welcome!

@param ExtendedPromiseInterface $target
@return callable
Creates a static rejection callback that is not bound to a promise instance .