Skip to content

Commit e3acfac

Browse files
author
Jeremiah VALERIE
committed
Merge branch '0.9'
2 parents 813f1a9 + e8e8ed2 commit e3acfac

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Relay/Connection/Paginator.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(callable $fetcher, $promise = self::MODE_REGULAR)
3535
* @param int|callable $total
3636
* @param array $callableArgs
3737
*
38-
* @return Connection
38+
* @return Connection|object A connection or a promise
3939
*/
4040
public function backward($args, $total, array $callableArgs = [])
4141
{
@@ -58,7 +58,7 @@ public function backward($args, $total, array $callableArgs = [])
5858
/**
5959
* @param Argument $args
6060
*
61-
* @return Connection
61+
* @return Connection|object A connection or a promise
6262
*/
6363
public function forward($args)
6464
{
@@ -90,7 +90,7 @@ public function forward($args)
9090
* @param int|callable $total
9191
* @param array $callableArgs
9292
*
93-
* @return Connection
93+
* @return Connection|object A connection or a promise
9494
*/
9595
public function auto($args, $total, $callableArgs = [])
9696
{
@@ -103,14 +103,16 @@ public function auto($args, $total, $callableArgs = [])
103103
}
104104

105105
if ($this->promise) {
106-
$connection->then(function (Connection $connection) use ($total, $callableArgs) {
106+
return $connection->then(function (Connection $connection) use ($total, $callableArgs) {
107107
$connection->totalCount = $this->computeTotalCount($total, $callableArgs);
108+
109+
return $connection;
108110
});
109111
} else {
110112
$connection->totalCount = $this->computeTotalCount($total, $callableArgs);
111-
}
112113

113-
return $connection;
114+
return $connection;
115+
}
114116
}
115117

116118
/**

0 commit comments

Comments
 (0)