@@ -19,7 +19,7 @@ public static function lazy($factory)
19
19
return new LazyPromise ($ factory );
20
20
}
21
21
22
- public static function all ($ promisesOrValues , $ onFulfilled = null , $ onRejected = null , $ onProgress = null )
22
+ public static function all ($ promisesOrValues , callable $ onFulfilled = null , callable $ onRejected = null , callable $ onProgress = null )
23
23
{
24
24
$ promise = static ::map ($ promisesOrValues , function ($ val ) {
25
25
return $ val ;
@@ -28,7 +28,7 @@ public static function all($promisesOrValues, $onFulfilled = null, $onRejected =
28
28
return $ promise ->then ($ onFulfilled , $ onRejected , $ onProgress );
29
29
}
30
30
31
- public static function any ($ promisesOrValues , $ onFulfilled = null , $ onRejected = null , $ onProgress = null )
31
+ public static function any ($ promisesOrValues , callable $ onFulfilled = null , callable $ onRejected = null , callable $ onProgress = null )
32
32
{
33
33
$ unwrapSingleResult = function ($ val ) use ($ onFulfilled ) {
34
34
$ val = array_shift ($ val );
@@ -39,7 +39,7 @@ public static function any($promisesOrValues, $onFulfilled = null, $onRejected =
39
39
return static ::some ($ promisesOrValues , 1 , $ unwrapSingleResult , $ onRejected , $ onProgress );
40
40
}
41
41
42
- public static function some ($ promisesOrValues , $ howMany , $ onFulfilled = null , $ onRejected = null , $ onProgress = null )
42
+ public static function some ($ promisesOrValues , $ howMany , callable $ onFulfilled = null , callable $ onRejected = null , callable $ onProgress = null )
43
43
{
44
44
return When::resolve ($ promisesOrValues )->then (function ($ array ) use ($ howMany , $ onFulfilled , $ onRejected , $ onProgress ) {
45
45
if (!is_array ($ array )) {
@@ -104,7 +104,7 @@ public static function some($promisesOrValues, $howMany, $onFulfilled = null, $o
104
104
});
105
105
}
106
106
107
- public static function map ($ promisesOrValues , $ mapFunc )
107
+ public static function map ($ promisesOrValues , callable $ mapFunc )
108
108
{
109
109
return When::resolve ($ promisesOrValues )->then (function ($ array ) use ($ mapFunc ) {
110
110
if (!is_array ($ array )) {
@@ -142,7 +142,7 @@ function ($mapped) use (&$values, $i, &$toResolve, $deferred) {
142
142
});
143
143
}
144
144
145
- public static function reduce ($ promisesOrValues , $ reduceFunc , $ initialValue = null )
145
+ public static function reduce ($ promisesOrValues , callable $ reduceFunc , $ initialValue = null )
146
146
{
147
147
return When::resolve ($ promisesOrValues )->then (function ($ array ) use ($ reduceFunc , $ initialValue ) {
148
148
if (!is_array ($ array )) {
0 commit comments