src/Executor/ReferenceExecutor.php
private function getPromise($value)
    {
        if ($value === null || $value instanceof Promise) {
            return $value;
        }
        if ($this->exeContext->promises->isThenable($value)) {
            $promise = $this->exeContext->promises->convertThenable($value);
            if (! $promise instanceof Promise) {
                throw new InvariantViolation(sprintf(
                    '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s',
                    get_class($this->exeContext->promises),
                    Utils::printSafe($promise)
                ));
            }

            return $promise;
        }

        return null;
    }
private function getPromise($value)
    {
        if ($value === null || $value instanceof Promise) {
            return $value;
        }
        if ($this->exeContext->promises->isThenable($value)) {
            $promise = $this->exeContext->promises->convertThenable($value);
            if (! $promise instanceof Promise) {
                throw new InvariantViolation(sprintf(
                    '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s',
                    get_class($this->exeContext->promises),
                    Utils::printSafe($promise)
                ));
            }

            return $promise;
        }

        return null;
    }
private function getPromise ( $ value ) { if ( $ value === null || $ value instanceof Promise ) { return $ value ; } if ( $ this -> exeContext -> promises -> isThenable ( $ value ) ) { $ promise = $ this -> exeContext -> promises -> convertThenable ( $ value ) ; if ( ! $ promise instanceof Promise ) { throw new InvariantViolation ( sprintf ( '%s::convertThenable is expected to return instance of GraphQL\Executor\Promise\Promise, got: %s' , get_class ( $ this -> exeContext -> promises ) , Utils :: printSafe ( $ promise ) ) ) ; } return $ promise ; } return null ; }
Only returns the value if it acts like a Promise, i.e. has a "then" function,
otherwise returns null.

@param mixed $value

@return Promise|null
Only returns the value if it acts like a Promise i . e . has a then function otherwise returns null .