Skip to content

Commit 11f1dcc

Browse files
committed
Update docblock for $id parameter
Use floor when converting float to int to ensure we don't hit 8.1 deprecation notice of loss of precision
1 parent d8b0c34 commit 11f1dcc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Request.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Request extends Notification implements RpcMessageInterface {
2626
* Request constructor.
2727
* @param string $method
2828
* @param array $params
29-
* @param null $id
29+
* @param string|int|float|null $id
3030
*/
3131
public function __construct(string $method, array $params = [], $id = null)
3232
{
@@ -41,13 +41,13 @@ public function __construct(string $method, array $params = [], $id = null)
4141

4242
/**
4343
* Set the id for the request. This is used between the Client and Server to correlate requests with responses.
44-
* @param string|float|null $id
44+
* @param string|int|float|null $id
4545
*/
4646
public function setId($id)
4747
{
4848
/** JSONRPC Spec - Numbers SHOULD NOT contain fractional parts */
4949
if (is_float($id)) {
50-
$id = (int)$id;
50+
$id = (int)floor($id);
5151
}
5252
/** String, Number, or NULL value */
5353
if (is_string($id) || is_int($id) || is_null($id)) {

0 commit comments

Comments
 (0)