Skip to content

Commit 65c3d16

Browse files
fix implicit nullable parameters (#127)
* fix implicit nullable parameters * bump deps * fix tests
1 parent f828302 commit 65c3d16

6 files changed

Lines changed: 14 additions & 14 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"require": {
2222
"php": ">=8.0",
2323
"guzzlehttp/guzzle": "^7.5.0",
24-
"firebase/php-jwt": "^v6.4.0"
24+
"firebase/php-jwt": "^v7.0.2"
2525
},
2626
"require-dev": {
2727
"friendsofphp/php-cs-fixer": "^3.14.0",

lib/GetStream/Stream/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function setLocation($location)
132132
* @param ?array $extra_data
133133
* @return string
134134
*/
135-
public function createUserSessionToken($user_id, array $extra_data=null)
135+
public function createUserSessionToken($user_id, ?array $extra_data=null)
136136
{
137137
if (is_null($extra_data)) {
138138
$extra_data = [];
@@ -145,7 +145,7 @@ public function createUserSessionToken($user_id, array $extra_data=null)
145145
* @param ?array $extra_data
146146
* @return string
147147
*/
148-
public function createUserToken($user_id, array $extra_data=null)
148+
public function createUserToken($user_id, ?array $extra_data=null)
149149
{
150150
if (is_null($extra_data)) {
151151
$extra_data = [];

lib/GetStream/Stream/ClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function getCustomHttpHandlerStack();
3030
* @param ?array $extra_data
3131
* @return string
3232
*/
33-
public function createUserSessionToken($user_id, array $extra_data = null);
33+
public function createUserSessionToken($user_id, ?array $extra_data = null);
3434

3535
/**
3636
* @param string $user_id
3737
* @param ?array $extra_data
3838
* @return string
3939
*/
40-
public function createUserToken($user_id, array $extra_data = null);
40+
public function createUserToken($user_id, ?array $extra_data = null);
4141

4242
/**
4343
* @param BaseFeedInterface $feed

lib/GetStream/Stream/Reactions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function doRequest($method, $endpoint, $params=null)
7171
*
7272
* @return array
7373
*/
74-
public function add($kind, $activityId, $userId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
74+
public function add($kind, $activityId, $userId, ?array $data=null, ?array $targetFeeds=null, $targetFeedsExtraData=null)
7575
{
7676
$payload = [
7777
'kind' => $kind,
@@ -102,7 +102,7 @@ public function add($kind, $activityId, $userId, array $data=null, array $target
102102
*
103103
* @return array
104104
*/
105-
public function addChild($kind, $parentId, $userId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
105+
public function addChild($kind, $parentId, $userId, ?array $data=null, ?array $targetFeeds=null, $targetFeedsExtraData=null)
106106
{
107107
$payload = [
108108
'kind' => $kind,
@@ -170,7 +170,7 @@ public function restore($reactionId)
170170
*
171171
* @return array
172172
*/
173-
public function filter($lookupField, $lookupValue, $kind=null, array $params=null)
173+
public function filter($lookupField, $lookupValue, $kind=null, ?array $params=null)
174174
{
175175
if (!in_array($lookupField, ["reaction_id", "activity_id", "user_id"])) {
176176
throw new StreamFeedException("Invalid request parameters");
@@ -205,7 +205,7 @@ public function get($reactionId)
205205
*
206206
* @return array
207207
*/
208-
public function update($reactionId, array $data=null, array $targetFeeds=null, $targetFeedsExtraData=null)
208+
public function update($reactionId, ?array $data=null, ?array $targetFeeds=null, $targetFeedsExtraData=null)
209209
{
210210
$payload = [];
211211
if ($data !== null) {

lib/GetStream/Stream/Users.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function doRequest($method, $endpoint, $params=null)
6565
*
6666
* @return array
6767
*/
68-
public function add($userId, array $data=null, $getOrCreate=null)
68+
public function add($userId, ?array $data=null, $getOrCreate=null)
6969
{
7070
$endpoint = 'user/';
7171
$payload = [
@@ -126,7 +126,7 @@ public function get($userId)
126126
127127
* @return array
128128
*/
129-
public function update($userId, array $data=null)
129+
public function update($userId, ?array $data=null)
130130
{
131131
$payload = [];
132132
if ($data !== null) {

tests/unit/ClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ public function testClientSigning()
4747

4848
public function testClientFeed()
4949
{
50-
$client = new Client('key', 'secret', $location='qa');
50+
$client = new Client('key', str_repeat('s', 32), $location='qa');
5151
$feed1 = $client->feed('flat', '1');
5252
$this->assertSame($feed1->getId(), 'flat:1');
5353
}
5454

5555
public function testCreateReference()
5656
{
57-
$client = new Client('key', 'secret', $location='qa');
57+
$client = new Client('key', str_repeat('s', 32), $location='qa');
5858
$ref = $client->collections()->createReference("item", "42");
5959
$this->assertEquals($ref, "SO:item:42");
6060
}
6161

6262
public function testCreateUserReference()
6363
{
64-
$client = new Client('key', 'secret', $location='qa');
64+
$client = new Client('key', str_repeat('s', 32), $location='qa');
6565
$ref = $client->users()->createReference("42");
6666
$this->assertEquals($ref, "SU:42");
6767
}

0 commit comments

Comments
 (0)