Skip to content

Commit 300a8c7

Browse files
committed
- [X] update php to 8.2
- [X] Fix some deprecated methods
1 parent 9494938 commit 300a8c7

30 files changed

Lines changed: 180 additions & 200 deletions

lib/ApiOperations/All.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
*/
1515
trait All
1616
{
17-
/**
18-
* @param array|null $params
19-
* @param array|string|null $opts
20-
*
21-
* @return array|TapObject
22-
*/
23-
public static function all($params = null, $opts = null)
17+
public static function all(array $params = null, array|string $opts = null): array|TapObject
2418
{
2519
self::_validateParams($params);
2620
$url = static::classUrl() . '/list';
@@ -33,7 +27,6 @@ public static function all($params = null, $opts = null)
3327
);
3428
}
3529
$obj->setLastResponse($response);
36-
// $obj->setFilters($params);
3730
return $obj;
3831
}
3932
}

lib/ApiOperations/Create.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
trait Create
1414
{
1515
/**
16-
* @param array|null $params
17-
* @param array|string|null $options
16+
* @param ?array $params
17+
* @param ?array|?string $options
1818
*
1919
* @return array|TapObject|\Tap\Customer The created resource.
2020
*/

lib/ApiOperations/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait Delete
1111
{
1212
/**
1313
* @param array|null $params
14-
* @param array|string|null $opts
14+
* @param ?array|?string $opts
1515
*
1616
* @return static The deleted resource.
1717
*/

lib/ApiOperations/NestedResource.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ trait NestedResource
1212
/**
1313
* @param string $method
1414
* @param string $url
15-
* @param array|null $params
16-
* @param array|string|null $options
15+
* @param ?array $params
16+
* @param ?array|?string $options
1717
*
1818
* @return \Tap\TapObject
1919
*/
@@ -30,7 +30,7 @@ protected static function _nestedResourceOperation($method, $url, $params = null
3030
/**
3131
* @param string $id
3232
* @param string $nestedPath
33-
* @param string|null $nestedId
33+
* @param ?string $nestedId
3434
*
3535
* @return string
3636
*/
@@ -46,8 +46,8 @@ protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null)
4646
/**
4747
* @param string $id
4848
* @param string $nestedPath
49-
* @param array|null $params
50-
* @param array|string|null $options
49+
* @param ?array $params
50+
* @param ?array|?string $options
5151
*
5252
* @return \Tap\TapObject
5353
*/
@@ -60,9 +60,9 @@ protected static function _createNestedResource($id, $nestedPath, $params = null
6060
/**
6161
* @param string $id
6262
* @param string $nestedPath
63-
* @param string|null $nestedId
64-
* @param array|null $params
65-
* @param array|string|null $options
63+
* @param ?string $nestedId
64+
* @param ?array $params
65+
* @param ?array|?string $options
6666
*
6767
* @return \Tap\TapObject
6868
*/
@@ -75,9 +75,9 @@ protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $
7575
/**
7676
* @param string $id
7777
* @param string $nestedPath
78-
* @param string|null $nestedId
79-
* @param array|null $params
80-
* @param array|string|null $options
78+
* @param ?string $nestedId
79+
* @param ?array $params
80+
* @param ?array|?string $options
8181
*
8282
* @return \Tap\TapObject
8383
*/
@@ -90,9 +90,9 @@ protected static function _updateNestedResource($id, $nestedPath, $nestedId, $pa
9090
/**
9191
* @param string $id
9292
* @param string $nestedPath
93-
* @param string|null $nestedId
94-
* @param array|null $params
95-
* @param array|string|null $options
93+
* @param ?string $nestedId
94+
* @param ?array $params
95+
* @param ?array|?string $options
9696
*
9797
* @return \Tap\TapObject
9898
*/
@@ -105,8 +105,8 @@ protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $pa
105105
/**
106106
* @param string $id
107107
* @param string $nestedPath
108-
* @param array|null $params
109-
* @param array|string|null $options
108+
* @param ?array $params
109+
* @param ?array|?string $options
110110
*
111111
* @return \Tap\TapObject | \Tap\Collection
112112
*/

lib/ApiOperations/Request.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
trait Request
1616
{
1717
/**
18-
* @param array|null|mixed $params The list of parameters to validate
18+
* @param ?mixed $params The list of parameters to validate
1919
*
2020
* @throws InvalidArgumentException if $params exists and is not an array
2121
*/
22-
protected static function _validateParams($params = null)
22+
protected static function _validateParams(mixed $params = null): void
2323
{
2424
if ($params && !is_array($params)) {
2525
$message = "You must pass an array as the first argument to Tap API "
@@ -47,7 +47,7 @@ protected static function _validateRequired($params, $required_vars)
4747
* @param string $method HTTP method ('get', 'post', etc.)
4848
* @param string $url URL for the request
4949
* @param array $params list of parameters for the request
50-
* @param array|string|null $options
50+
* @param ?array|?string $options
5151
*
5252
* @throws ApiErrorException if the request fails
5353
*
@@ -65,7 +65,7 @@ protected function _request($method, $url, $params = [], $options = null)
6565
* @param string $method HTTP method ('get', 'post', etc.)
6666
* @param string $url URL for the request
6767
* @param array $params list of parameters for the request
68-
* @param array|string|null $options
68+
* @param ?array|?string $options
6969
*
7070
* @throws ApiErrorException if the request fails
7171
*

lib/ApiOperations/Retrieve.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ trait Retrieve
1313
/**
1414
* @param array|string $id The ID of the API resource to retrieve,
1515
* or an options array containing an `id` key.
16-
* @param array|string|null $opts
16+
* @param ?array|?string $opts
1717
*
1818
* @return static
1919
*/
20-
public static function retrieve($id, $opts = null)
20+
public static function retrieve(array|string $id, array|string $opts = null): static
2121
{
2222
$opts = \Tap\Util\RequestOptions::parse($opts);
2323
$instance = new static($id, $opts);

lib/ApiOperations/Update.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ trait Update
1414
{
1515
/**
1616
* @param string $id The ID of the resource to update.
17-
* @param array|null $params
18-
* @param array|string|null $opts
17+
* @param ?array $params
18+
* @param ?array|?string $opts
1919
*
2020
* @return array|\Tap\TapObject The updated resource.
2121
*/
@@ -31,7 +31,7 @@ public static function update($id, $params = null, $opts = null)
3131
}
3232

3333
/**
34-
* @param array|string|null $opts
34+
* @param ?array|?string $opts
3535
*
3636
* @return static The saved resource.
3737
*/

lib/ApiRequestor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ class ApiRequestor
3131

3232
/**
3333
* Creates a telemetry json blob for use in 'X-Tap-Client-Telemetry' headers
34-
* @static
35-
*
36-
* @param RequestTelemetry $requestTelemetry
37-
* @return string
3834
*/
3935
private static function _telemetryJson($requestTelemetry)
4036
{

lib/ApiResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function classUrl()
8484
// Replace dots with slashes for namespaced resources, e.g. if the object's name is
8585
// "foo.bar", then its URL will be "/v1/foo/bars".
8686
$base = str_replace('.', '/', static::OBJECT_NAME);
87-
return "/v2/${base}s";
87+
return "/v2/{$base}s";
8888
}
8989

9090
/**

lib/ApiResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class ApiResponse
1919
/**
2020
* @param string $body
2121
* @param integer $code
22-
* @param array|CaseInsensitiveArray|null $headers
23-
* @param array|null $json
22+
* @param array|CaseInsensitiveArray $headers
23+
* @param ?array $json
2424
*/
2525
public function __construct($body, $code, $headers, $json)
2626
{

0 commit comments

Comments
 (0)