Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Promise v3 template types #183

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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