@@ -35,7 +35,7 @@ public function __construct(callable $fetcher, $promise = self::MODE_REGULAR)
35
35
* @param int|callable $total
36
36
* @param array $callableArgs
37
37
*
38
- * @return Connection
38
+ * @return Connection|object A connection or a promise
39
39
*/
40
40
public function backward ($ args , $ total , array $ callableArgs = [])
41
41
{
@@ -58,7 +58,7 @@ public function backward($args, $total, array $callableArgs = [])
58
58
/**
59
59
* @param Argument $args
60
60
*
61
- * @return Connection
61
+ * @return Connection|object A connection or a promise
62
62
*/
63
63
public function forward ($ args )
64
64
{
@@ -90,7 +90,7 @@ public function forward($args)
90
90
* @param int|callable $total
91
91
* @param array $callableArgs
92
92
*
93
- * @return Connection
93
+ * @return Connection|object A connection or a promise
94
94
*/
95
95
public function auto ($ args , $ total , $ callableArgs = [])
96
96
{
@@ -103,14 +103,16 @@ public function auto($args, $total, $callableArgs = [])
103
103
}
104
104
105
105
if ($ this ->promise ) {
106
- $ connection ->then (function (Connection $ connection ) use ($ total , $ callableArgs ) {
106
+ return $ connection ->then (function (Connection $ connection ) use ($ total , $ callableArgs ) {
107
107
$ connection ->totalCount = $ this ->computeTotalCount ($ total , $ callableArgs );
108
+
109
+ return $ connection ;
108
110
});
109
111
} else {
110
112
$ connection ->totalCount = $ this ->computeTotalCount ($ total , $ callableArgs );
111
- }
112
113
113
- return $ connection ;
114
+ return $ connection ;
115
+ }
114
116
}
115
117
116
118
/**
0 commit comments