Skip to content

Commit

Permalink
Merge pull request #183 from clue-labs/template-types
Browse files Browse the repository at this point in the history
Use Promise v3 template types
  • Loading branch information
WyriHaximus authored Nov 9, 2023
2 parents 28ccb94 + cb5c9b4 commit 800e32e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ $factory = new React\MySQL\Factory(null, $connector);

#### createConnection()

The `createConnection(string $url): PromiseInterface<ConnectionInterface, Exception>` method can be used to
The `createConnection(string $url): PromiseInterface<ConnectionInterface>` method can be used to
create a new [`ConnectionInterface`](#connectioninterface).

It helps with establishing a TCP/IP connection to your MySQL database
Expand Down Expand Up @@ -311,7 +311,7 @@ and sending your database queries.

#### query()

The `query(string $query, array $params = []): PromiseInterface` method can be used to
The `query(string $query, array $params = []): PromiseInterface<QueryResult>` method can be used to
perform an async query.

This method returns a promise that will resolve with a `QueryResult` on
Expand Down Expand Up @@ -424,7 +424,7 @@ suited for exposing multiple possible results.

#### ping()

The `ping(): PromiseInterface<void, Exception>` method can be used to
The `ping(): PromiseInterface<void>` method can be used to
check that the connection is alive.

This method returns a promise that will resolve (with a void value) on
Expand All @@ -443,7 +443,7 @@ $connection->ping()->then(function () {

#### quit()

The `quit(): PromiseInterface<void, Exception>` method can be used to
The `quit(): PromiseInterface<void>` method can be used to
quit (soft-close) the connection.

This method returns a promise that will resolve (with a void value) on
Expand Down
9 changes: 6 additions & 3 deletions src/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ interface ConnectionInterface extends EventEmitterInterface
*
* @param string $sql SQL statement
* @param array $params Parameters which should be bound to query
* @return PromiseInterface Returns a Promise<QueryResult,Exception>
* @return PromiseInterface<QueryResult>
* Resolves with a `QueryResult` on success or rejects with an `Exception` on error.
*/
public function query($sql, array $params = []);

Expand Down Expand Up @@ -180,7 +181,8 @@ public function queryStream($sql, $params = []);
* });
* ```
*
* @return PromiseInterface Returns a Promise<true,Exception>
* @return PromiseInterface<void>
* Resolves with a `void` value on success or rejects with an `Exception` on error.
*/
public function ping();

Expand All @@ -198,7 +200,8 @@ public function ping();
* $connection->quit();
* ```
*
* @return PromiseInterface Returns a Promise<void,Exception>
* @return PromiseInterface<void>
* Resolves with a `void` value on success or rejects with an `Exception` on error.
*/
public function quit();

Expand Down
3 changes: 2 additions & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public function __construct(LoopInterface $loop = null, ConnectorInterface $conn
* ```
*
* @param string $uri
* @return PromiseInterface Promise<ConnectionInterface, Exception>
* @return PromiseInterface<ConnectionInterface>
* Resolves with a `ConnectionInterface` on success or rejects with an `Exception` on error.
*/
public function createConnection(
#[\SensitiveParameter]
Expand Down

0 comments on commit 800e32e

Please sign in to comment.