@@ -41,19 +41,19 @@ function resolve($promiseOrValue = null)
4141}
4242
4343/**
44- * Creates a rejected promise for the supplied `$promiseOrValue `.
44+ * Creates a rejected promise for the supplied `$reason `.
4545 *
46- * If `$promiseOrValue ` is a value, it will be the rejection value of the
46+ * If `$reason ` is a value, it will be the rejection value of the
4747 * returned promise.
4848 *
49- * If `$promiseOrValue ` is a promise, its completion value will be the rejected
49+ * If `$reason ` is a promise, its completion value will be the rejected
5050 * value of the returned promise.
5151 *
5252 * This can be useful in situations where you need to reject a promise without
5353 * throwing an exception. For example, it allows you to propagate a rejection with
5454 * the value of another promise.
5555 *
56- * @param \Throwable $promiseOrValue
56+ * @param \Throwable $reason
5757 * @return PromiseInterface
5858 */
5959function reject (\Throwable $ reason )
@@ -188,7 +188,7 @@ function some(array $promisesOrValues, $howMany)
188188 }
189189 };
190190
191- $ rejecter = function ($ reason ) use ($ i , &$ reasons , &$ toReject , $ toResolve , $ reject ) {
191+ $ rejecter = function (\ Throwable $ reason ) use ($ i , &$ reasons , &$ toReject , $ toResolve , $ reject ) {
192192 if ($ toResolve < 1 || $ toReject < 1 ) {
193193 return ;
194194 }
@@ -324,12 +324,8 @@ function fatalError($error)
324324/**
325325 * @internal
326326 */
327- function _checkTypehint (callable $ callback , $ object )
327+ function _checkTypehint (callable $ callback , \ Throwable $ reason )
328328{
329- if (!\is_object ($ object )) {
330- return true ;
331- }
332-
333329 if (\is_array ($ callback )) {
334330 $ callbackReflection = new \ReflectionMethod ($ callback [0 ], $ callback [1 ]);
335331 } elseif (\is_object ($ callback ) && !$ callback instanceof \Closure) {
@@ -344,11 +340,11 @@ function _checkTypehint(callable $callback, $object)
344340 return true ;
345341 }
346342
347- $ expectedException = $ parameters [0 ];
343+ $ expectedClass = $ parameters [0 ]-> getClass () ;
348344
349- if (!$ expectedException -> getClass () ) {
345+ if (!$ expectedClass ) {
350346 return true ;
351347 }
352348
353- return $ expectedException -> getClass ()-> isInstance ($ object );
349+ return $ expectedClass -> isInstance ($ reason );
354350}
0 commit comments