@@ -50,7 +50,7 @@ public function __construct(callable $fetcher, $promise = self::MODE_REGULAR)
50
50
* @param int|callable $total
51
51
* @param array $callableArgs
52
52
*
53
- * @return Connection
53
+ * @return Connection|object A connection or a promise
54
54
*/
55
55
public function backward ($ args , $ total , array $ callableArgs = [])
56
56
{
@@ -73,7 +73,7 @@ public function backward($args, $total, array $callableArgs = [])
73
73
/**
74
74
* @param Argument|array $args
75
75
*
76
- * @return Connection
76
+ * @return Connection|object A connection or a promise
77
77
*/
78
78
public function forward ($ args )
79
79
{
@@ -105,7 +105,7 @@ public function forward($args)
105
105
* @param int|callable $total
106
106
* @param array $callableArgs
107
107
*
108
- * @return Connection
108
+ * @return Connection|object A connection or a promise
109
109
*/
110
110
public function auto ($ args , $ total , $ callableArgs = [])
111
111
{
@@ -118,14 +118,16 @@ public function auto($args, $total, $callableArgs = [])
118
118
}
119
119
120
120
if ($ this ->promise ) {
121
- $ connection ->then (function (Connection $ connection ) use ($ total , $ callableArgs ) {
121
+ return $ connection ->then (function (Connection $ connection ) use ($ total , $ callableArgs ) {
122
122
$ connection ->totalCount = $ this ->computeTotalCount ($ total , $ callableArgs );
123
+
124
+ return $ connection ;
123
125
});
124
126
} else {
125
127
$ connection ->totalCount = $ this ->computeTotalCount ($ total , $ callableArgs );
126
- }
127
128
128
- return $ connection ;
129
+ return $ connection ;
130
+ }
129
131
}
130
132
131
133
/**
0 commit comments