Skip to content

Commit 14b073d

Browse files
committed
Set nullable type explicitly
1 parent 1efa6c6 commit 14b073d

11 files changed

Lines changed: 22 additions & 21 deletions

File tree

src/Endpoints/Collections/Points.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function search(SearchRequest $searchParams, array $queryParams = []): Re
5050
/**
5151
* @throws InvalidArgumentException
5252
*/
53-
public function scroll(Filter|ScrollRequest $scrollParams = null, array $queryParams = []): Response
53+
public function scroll(Filter|ScrollRequest|null $scrollParams = null, array $queryParams = []): Response
5454
{
5555
$body = [];
5656
if ($scrollParams instanceof Filter) {
@@ -133,7 +133,7 @@ public function id(int|string $id, array $queryParams = []): Response
133133
/**
134134
* @throws InvalidArgumentException
135135
*/
136-
public function count(Filter $filter = null, $exact = false): Response
136+
public function count(?Filter $filter = null, $exact = false): Response
137137
{
138138
$body = [
139139
'exact' => $exact,

src/Endpoints/Collections/Points/Payload.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ public function clear(array $points): Response
3737
* @param array $points
3838
* @param array $keys
3939
* @param Filter|null $filter
40+
* @param array $queryParams
4041
* @return Response
4142
* @throws InvalidArgumentException
4243
*/
43-
public function delete(array $points, array $keys, Filter $filter = null, array $queryParams = []): Response
44+
public function delete(array $points, array $keys, ?Filter $filter = null, array $queryParams = []): Response
4445
{
4546
$data = [
4647
'points' => $points,
@@ -75,4 +76,4 @@ public function set(array $points, array $payload, array $queryParams = []): Res
7576
)
7677
);
7778
}
78-
}
79+
}

src/Endpoints/Collections/Snapshots.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function download(string $snapshotName): Response
6868
/**
6969
* @throws InvalidArgumentException
7070
*/
71-
public function recover(bool $wait = null): Response
71+
public function recover(?bool $wait = null): Response
7272
{
7373
return $this->client->execute(
7474
$this->createRequest(
@@ -77,4 +77,4 @@ public function recover(bool $wait = null): Response
7777
)
7878
);
7979
}
80-
}
80+
}

src/Http/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Builder
1616
{
1717
protected ?ClientInterface $client;
18-
public function __construct(ClientInterface $client = null) {
18+
public function __construct(?ClientInterface $client = null) {
1919
$this->client = $client ?: Psr18ClientDiscovery::find();
2020
}
2121

@@ -26,4 +26,4 @@ public function build(Config $config): Transport
2626
$config
2727
);
2828
}
29-
}
29+
}

src/Models/MultiVectorStruct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getName(): ?string
2929
return array_key_first($this->vectors);
3030
}
3131

32-
public function toSearchArray(string $name = null): array
32+
public function toSearchArray(?string $name = null): array
3333
{
3434
// Throw an error if no name is given
3535
if ($name === null) {

src/Models/Request/CreateCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CreateCollection implements RequestModel
3737

3838
protected ?QuantizationConfig $quantizationConfig = null;
3939

40-
public function addVector(VectorParams $vectorParams, string $name = null): CreateCollection
40+
public function addVector(VectorParams $vectorParams, ?string $name = null): CreateCollection
4141
{
4242
if ($name !== null) {
4343
$this->vectors[$name] = $vectorParams->toArray();
@@ -150,4 +150,4 @@ public function toArray(): array
150150

151151
return $data;
152152
}
153-
}
153+
}

src/Models/Request/CreateIndex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CreateIndex implements RequestModel
1111
protected string $fieldName;
1212
protected ?array $fieldSchema;
1313

14-
public function __construct(string $fieldName, array|string $fieldSchema = null)
14+
public function __construct(string $fieldName, array|string|null $fieldSchema = null)
1515
{
1616
if (is_string($fieldSchema)) {
1717
$this->fieldSchema = [
@@ -31,4 +31,4 @@ public function toArray(): array
3131
'field_schema' => $this->fieldSchema
3232
]);
3333
}
34-
}
34+
}

src/Models/VectorStruct.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getName(): ?string
2626
return $this->name;
2727
}
2828

29-
public function toSearchArray(string $name = null): array
29+
public function toSearchArray(?string $name = null): array
3030
{
3131
if ($this->isNamed()) {
3232
return [
@@ -46,4 +46,4 @@ public function toArray(): array
4646
}
4747
return $this->vector;
4848
}
49-
}
49+
}

src/Models/VectorStructInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public function getName(): ?string;
1717
* @param string|null $name
1818
* @return array
1919
*/
20-
public function toSearchArray(string $name = null): array;
20+
public function toSearchArray(?string $name = null): array;
2121

2222
/**
2323
* Convert this vector an array for Point and PointsBatch.
2424
*
2525
* @return array
2626
*/
2727
public function toArray(): array;
28-
}
28+
}

src/Qdrant.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(private readonly Transport $transport)
2020
{
2121
}
2222

23-
public function collections(string $collectionName = null): Collections
23+
public function collections(?string $collectionName = null): Collections
2424
{
2525
return (new Collections($this))->setCollectionName($collectionName);
2626
}
@@ -60,4 +60,4 @@ public function execute(RequestInterface $request): Response
6060

6161
return new Response($res);
6262
}
63-
}
63+
}

0 commit comments

Comments
 (0)