From 6c788dbd9f8d826b3a5778c3447c2956df054501 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Tue, 1 Oct 2024 21:35:57 -0700 Subject: [PATCH] PCBC-1010: use explicit nullable types where applicable Otherwise PHP 8.4 will emit deprecation warning --- Couchbase/AnalyticsOptions.php | 2 +- Couchbase/BinaryCollection.php | 8 ++-- Couchbase/BinaryCollectionInterface.php | 8 ++-- Couchbase/Bucket.php | 4 +- Couchbase/BucketInterface.php | 2 +- Couchbase/Cluster.php | 8 ++-- Couchbase/ClusterInterface.php | 4 +- Couchbase/Collection.php | 40 +++++++++--------- Couchbase/CollectionInterface.php | 28 ++++++------- Couchbase/Exception/CouchbaseException.php | 2 +- Couchbase/GeoDistanceSearchQuery.php | 4 +- .../Management/AnalyticsIndexManager.php | 30 ++++++------- Couchbase/Management/BucketManager.php | 12 +++--- .../Management/BucketManagerInterface.php | 30 ++++++++++--- Couchbase/Management/CollectionManager.php | 8 ++-- .../Management/CollectionManagerInterface.php | 24 +++++++++-- .../CollectionQueryIndexManager.php | 14 +++---- .../CollectionQueryIndexManagerInterface.php | 30 +++++++++---- Couchbase/Management/CollectionSpec.php | 4 +- .../Management/CreateCollectionSettings.php | 4 +- Couchbase/Management/QueryIndexManager.php | 14 +++---- .../Management/QueryIndexManagerInterface.php | 32 ++++++++++---- .../Management/ScopeSearchIndexManager.php | 24 +++++------ .../ScopeSearchIndexManagerInterface.php | 42 +++++++++++++------ Couchbase/Management/SearchIndexManager.php | 24 +++++------ .../SearchIndexManagerInterface.php | 40 ++++++++++++------ .../Management/UpdateCollectionSettings.php | 4 +- Couchbase/Management/UserManager.php | 20 ++++----- Couchbase/Management/UserManagerInterface.php | 38 ++++++++++++----- Couchbase/NoopTracer.php | 2 +- Couchbase/NumericRangeSearchFacet.php | 2 +- Couchbase/Protostellar/BinaryCollection.php | 8 ++-- Couchbase/Protostellar/Bucket.php | 2 +- Couchbase/Protostellar/Cluster.php | 6 +-- Couchbase/Protostellar/Collection.php | 28 ++++++------- .../Internal/KV/KVRequestConverter.php | 28 ++++++++++--- .../Internal/KV/KVResponseConverter.php | 26 +++++++++--- .../CollectionManagementRequestConverter.php | 2 +- .../SearchIndexManagementRequestConverter.php | 26 ++++++------ .../Protostellar/Management/BucketManager.php | 12 +++--- .../Management/CollectionManager.php | 8 ++-- .../CollectionQueryIndexManager.php | 14 +++---- .../Management/QueryIndexManager.php | 14 +++---- .../Management/SearchIndexManager.php | 24 +++++------ Couchbase/Protostellar/ProtocolException.php | 2 +- .../Retries/BestEffortRetryStrategy.php | 2 +- Couchbase/Protostellar/Scope.php | 4 +- Couchbase/QueryOptions.php | 2 +- Couchbase/RangeScan.php | 4 +- Couchbase/RequestTracer.php | 2 +- Couchbase/SamplingScan.php | 4 +- Couchbase/ScanTerm.php | 4 +- Couchbase/Scope.php | 6 +-- Couchbase/ScopeInterface.php | 6 +-- Couchbase/SearchOptions.php | 2 +- Couchbase/ThresholdLoggingTracer.php | 2 +- Couchbase/TransactionQueryOptions.php | 2 +- Couchbase/VectorSearch.php | 4 +- tests/CollectionManagerTest.php | 2 +- 59 files changed, 454 insertions(+), 300 deletions(-) diff --git a/Couchbase/AnalyticsOptions.php b/Couchbase/AnalyticsOptions.php index f51197cf..dbc9ebf1 100644 --- a/Couchbase/AnalyticsOptions.php +++ b/Couchbase/AnalyticsOptions.php @@ -204,7 +204,7 @@ public static function getTranscoder(?AnalyticsOptions $options): Transcoder return $options->transcoder; } - public static function export(?AnalyticsOptions $options, string $scopeName = null, string $bucketName = null): array + public static function export(?AnalyticsOptions $options, ?string $scopeName = null, ?string $bucketName = null): array { if ($options == null) { return [ diff --git a/Couchbase/BinaryCollection.php b/Couchbase/BinaryCollection.php index 06f40025..0e532821 100644 --- a/Couchbase/BinaryCollection.php +++ b/Couchbase/BinaryCollection.php @@ -78,7 +78,7 @@ public function name(): string * @throws CouchbaseException * @since 4.0.0 */ - public function append(string $id, string $value, AppendOptions $options = null): MutationResult + public function append(string $id, string $value, ?AppendOptions $options = null): MutationResult { $response = Extension\documentAppend( $this->core, @@ -105,7 +105,7 @@ public function append(string $id, string $value, AppendOptions $options = null) * @throws CouchbaseException * @since 4.0.0 */ - public function prepend(string $id, string $value, PrependOptions $options = null): MutationResult + public function prepend(string $id, string $value, ?PrependOptions $options = null): MutationResult { $response = Extension\documentPrepend( $this->core, @@ -131,7 +131,7 @@ public function prepend(string $id, string $value, PrependOptions $options = nul * @throws CouchbaseException * @since 4.0.0 */ - public function increment(string $id, IncrementOptions $options = null): CounterResult + public function increment(string $id, ?IncrementOptions $options = null): CounterResult { $response = Extension\documentIncrement( $this->core, @@ -156,7 +156,7 @@ public function increment(string $id, IncrementOptions $options = null): Counter * @throws CouchbaseException * @since 4.0.0 */ - public function decrement(string $id, DecrementOptions $options = null): CounterResult + public function decrement(string $id, ?DecrementOptions $options = null): CounterResult { $response = Extension\documentDecrement( $this->core, diff --git a/Couchbase/BinaryCollectionInterface.php b/Couchbase/BinaryCollectionInterface.php index 2fb427f4..7ceb9faf 100644 --- a/Couchbase/BinaryCollectionInterface.php +++ b/Couchbase/BinaryCollectionInterface.php @@ -24,11 +24,11 @@ interface BinaryCollectionInterface { public function name(): string; - public function append(string $id, string $value, AppendOptions $options = null): MutationResult; + public function append(string $id, string $value, ?AppendOptions $options = null): MutationResult; - public function prepend(string $id, string $value, PrependOptions $options = null): MutationResult; + public function prepend(string $id, string $value, ?PrependOptions $options = null): MutationResult; - public function increment(string $id, IncrementOptions $options = null): CounterResult; + public function increment(string $id, ?IncrementOptions $options = null): CounterResult; - public function decrement(string $id, DecrementOptions $options = null): CounterResult; + public function decrement(string $id, ?DecrementOptions $options = null): CounterResult; } diff --git a/Couchbase/Bucket.php b/Couchbase/Bucket.php index 8887f75c..2d13f3fa 100644 --- a/Couchbase/Bucket.php +++ b/Couchbase/Bucket.php @@ -123,7 +123,7 @@ public function name(): string * @return ViewResult * @since 4.0.0 */ - public function viewQuery(string $designDoc, string $viewName, ViewOptions $options = null): ViewResult + public function viewQuery(string $designDoc, string $viewName, ?ViewOptions $options = null): ViewResult { $opts = ViewOptions::export($options); $namespace = $opts["namespace"]; @@ -195,7 +195,7 @@ public function ping($services = null, $reportId = null) * @deprecated - see cluster->diagnostics * @since 4.0.0 */ - public function diagnostics(string $reportId = null) + public function diagnostics(?string $reportId = null) { if ($reportId == null) { $reportId = uniqid(); diff --git a/Couchbase/BucketInterface.php b/Couchbase/BucketInterface.php index 332cc653..a657ede6 100644 --- a/Couchbase/BucketInterface.php +++ b/Couchbase/BucketInterface.php @@ -30,5 +30,5 @@ public function scope(string $name): ScopeInterface; public function name(): string; - public function viewQuery(string $designDoc, string $viewName, ViewOptions $options = null): ViewResult; + public function viewQuery(string $designDoc, string $viewName, ?ViewOptions $options = null): ViewResult; } diff --git a/Couchbase/Cluster.php b/Couchbase/Cluster.php index b894d1a6..06ed0f06 100644 --- a/Couchbase/Cluster.php +++ b/Couchbase/Cluster.php @@ -184,7 +184,7 @@ public function query(string $statement, ?QueryOptions $options = null): QueryRe * @throws CouchbaseException * @since 4.0.0 */ - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { $result = Extension\analyticsQuery($this->core, $statement, AnalyticsOptions::export($options)); @@ -202,7 +202,7 @@ public function analyticsQuery(string $statement, AnalyticsOptions $options = nu * @return SearchResult * @since 4.0.0 */ - public function searchQuery(string $indexName, SearchQuery $query, SearchOptions $options = null): SearchResult + public function searchQuery(string $indexName, SearchQuery $query, ?SearchOptions $options = null): SearchResult { $result = Extension\searchQuery($this->core, $indexName, json_encode($query), SearchOptions::export($options)); @@ -222,7 +222,7 @@ public function searchQuery(string $indexName, SearchQuery $query, SearchOptions * @throws InvalidArgumentException * @since 4.1.7 */ - public function search(string $indexName, SearchRequest $request, SearchOptions $options = null): SearchResult + public function search(string $indexName, SearchRequest $request, ?SearchOptions $options = null): SearchResult { $exportedRequest = SearchRequest::export($request); $exportedOptions = SearchOptions::export($options); @@ -329,7 +329,7 @@ public function ping($services = null, $reportId = null) * * @since 4.0.0 */ - public function diagnostics(string $reportId = null) + public function diagnostics(?string $reportId = null) { if ($reportId == null) { $reportId = uniqid(); diff --git a/Couchbase/ClusterInterface.php b/Couchbase/ClusterInterface.php index 02892285..f8ef48bf 100644 --- a/Couchbase/ClusterInterface.php +++ b/Couchbase/ClusterInterface.php @@ -26,7 +26,7 @@ public function bucket(string $name): BucketInterface; public function query(string $statement, ?QueryOptions $options = null): QueryResult; - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult; + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult; - public function searchQuery(string $indexName, SearchQuery $query, SearchOptions $options = null): SearchResult; + public function searchQuery(string $indexName, SearchQuery $query, ?SearchOptions $options = null): SearchResult; } diff --git a/Couchbase/Collection.php b/Couchbase/Collection.php index c316b42e..5a5c070f 100644 --- a/Couchbase/Collection.php +++ b/Couchbase/Collection.php @@ -113,7 +113,7 @@ public function name(): string * @throws CouchbaseException * @since 4.0.0 */ - public function get(string $id, GetOptions $options = null): GetResult + public function get(string $id, ?GetOptions $options = null): GetResult { $response = Extension\documentGet( $this->core, @@ -137,7 +137,7 @@ public function get(string $id, GetOptions $options = null): GetResult * @throws CouchbaseException * @since 4.0.0 */ - public function exists(string $id, ExistsOptions $options = null): ExistsResult + public function exists(string $id, ?ExistsOptions $options = null): ExistsResult { $response = Extension\documentExists( $this->core, @@ -164,7 +164,7 @@ public function exists(string $id, ExistsOptions $options = null): ExistsResult * @throws CouchbaseException * @since 4.0.0 */ - public function getAndLock(string $id, int $lockTimeSeconds, GetAndLockOptions $options = null): GetResult + public function getAndLock(string $id, int $lockTimeSeconds, ?GetAndLockOptions $options = null): GetResult { $response = Extension\documentGetAndLock( $this->core, @@ -191,7 +191,7 @@ public function getAndLock(string $id, int $lockTimeSeconds, GetAndLockOptions $ * @throws CouchbaseException * @since 4.0.0 */ - public function getAndTouch(string $id, $expiry, GetAndTouchOptions $options = null): GetResult + public function getAndTouch(string $id, $expiry, ?GetAndTouchOptions $options = null): GetResult { if ($expiry instanceof DateTimeInterface) { $expirySeconds = $expiry->getTimestamp(); @@ -223,7 +223,7 @@ public function getAndTouch(string $id, $expiry, GetAndTouchOptions $options = n * @throws TimeoutException * @since 4.0.1 */ - public function getAnyReplica(string $id, GetAnyReplicaOptions $options = null): GetReplicaResult + public function getAnyReplica(string $id, ?GetAnyReplicaOptions $options = null): GetReplicaResult { $response = Extension\documentGetAnyReplica( $this->core, @@ -248,7 +248,7 @@ public function getAnyReplica(string $id, GetAnyReplicaOptions $options = null): * @throws TimeoutException * @since 4.0.0 */ - public function getAllReplicas(string $id, GetAllReplicasOptions $options = null): array + public function getAllReplicas(string $id, ?GetAllReplicasOptions $options = null): array { $responses = Extension\documentGetAllReplicas( $this->core, @@ -278,7 +278,7 @@ function (array $response) use ($options) { * @throws CouchbaseException * @since 4.0.0 */ - public function upsert(string $id, $value, UpsertOptions $options = null): MutationResult + public function upsert(string $id, $value, ?UpsertOptions $options = null): MutationResult { $encoded = UpsertOptions::encodeDocument($options, $value); $response = Extension\documentUpsert( @@ -307,7 +307,7 @@ public function upsert(string $id, $value, UpsertOptions $options = null): Mutat * @throws CouchbaseException * @since 4.0.0 */ - public function insert(string $id, $value, InsertOptions $options = null): MutationResult + public function insert(string $id, $value, ?InsertOptions $options = null): MutationResult { $encoded = InsertOptions::encodeDocument($options, $value); $response = Extension\documentInsert( @@ -337,7 +337,7 @@ public function insert(string $id, $value, InsertOptions $options = null): Mutat * @throws CouchbaseException * @since 4.0.0 */ - public function replace(string $id, $value, ReplaceOptions $options = null): MutationResult + public function replace(string $id, $value, ?ReplaceOptions $options = null): MutationResult { $encoded = ReplaceOptions::encodeDocument($options, $value); $response = Extension\documentReplace( @@ -366,7 +366,7 @@ public function replace(string $id, $value, ReplaceOptions $options = null): Mut * @throws DocumentNotFoundException * @since 4.0.0 */ - public function remove(string $id, RemoveOptions $options = null): MutationResult + public function remove(string $id, ?RemoveOptions $options = null): MutationResult { $response = Extension\documentRemove( $this->core, @@ -394,7 +394,7 @@ public function remove(string $id, RemoveOptions $options = null): MutationResul * @throws CouchbaseException * @since 4.0.0 */ - public function unlock(string $id, string $cas, UnlockOptions $options = null): Result + public function unlock(string $id, string $cas, ?UnlockOptions $options = null): Result { $response = Extension\documentUnlock( $this->core, @@ -421,7 +421,7 @@ public function unlock(string $id, string $cas, UnlockOptions $options = null): * @throws CouchbaseException * @since 4.0.0 */ - public function touch(string $id, $expiry, TouchOptions $options = null): MutationResult + public function touch(string $id, $expiry, ?TouchOptions $options = null): MutationResult { if ($expiry instanceof DateTimeInterface) { $expirySeconds = $expiry->getTimestamp(); @@ -453,7 +453,7 @@ public function touch(string $id, $expiry, TouchOptions $options = null): Mutati * @throws CouchbaseException * @since 4.0.0 */ - public function lookupIn(string $id, array $specs, LookupInOptions $options = null): LookupInResult + public function lookupIn(string $id, array $specs, ?LookupInOptions $options = null): LookupInResult { $encoded = array_map( function (LookupInSpec $item) { @@ -489,7 +489,7 @@ function (LookupInSpec $item) { * @throws CouchbaseException * @since 4.1.6 */ - public function lookupInAnyReplica(string $id, array $specs, LookupInAnyReplicaOptions $options = null): LookupInReplicaResult + public function lookupInAnyReplica(string $id, array $specs, ?LookupInAnyReplicaOptions $options = null): LookupInReplicaResult { $encoded = array_map( function (LookupInSpec $item) { @@ -526,7 +526,7 @@ function (LookupInSpec $item) { * @throws CouchbaseException * @since 4.1.6 */ - public function lookupInAllReplicas(string $id, array $specs, LookupInAllReplicasOptions $options = null): array + public function lookupInAllReplicas(string $id, array $specs, ?LookupInAllReplicasOptions $options = null): array { $encoded = array_map( function (LookupInSpec $item) { @@ -568,7 +568,7 @@ function (array $response) use ($options) { * @throws CouchbaseException * @since 4.0.0 */ - public function mutateIn(string $id, array $specs, MutateInOptions $options = null): MutateInResult + public function mutateIn(string $id, array $specs, ?MutateInOptions $options = null): MutateInResult { $encoded = array_map( function (MutateInSpec $item) use ($options) { @@ -598,7 +598,7 @@ function (MutateInSpec $item) use ($options) { * @return array array of GetResult, one for each of the entries * @since 4.0.0 */ - public function getMulti(array $ids, GetOptions $options = null): array + public function getMulti(array $ids, ?GetOptions $options = null): array { $responses = Extension\documentGetMulti( $this->core, @@ -630,7 +630,7 @@ function (array $response) use ($options) { * @throws InvalidArgumentException * @since 4.1.6 */ - public function scan(ScanType $scanType, ScanOptions $options = null): ScanResults + public function scan(ScanType $scanType, ?ScanOptions $options = null): ScanResults { if ($scanType instanceof RangeScan) { $type = RangeScan::export($scanType); @@ -664,7 +664,7 @@ public function scan(ScanType $scanType, ScanOptions $options = null): ScanResul * @throws UnsupportedOperationException * @since 4.0.0 */ - public function removeMulti(array $entries, RemoveOptions $options = null): array + public function removeMulti(array $entries, ?RemoveOptions $options = null): array { $responses = Extension\documentRemoveMulti( $this->core, @@ -693,7 +693,7 @@ function (array $response) { * @throws InvalidArgumentException * @since 4.0.0 */ - public function upsertMulti(array $entries, UpsertOptions $options = null): array + public function upsertMulti(array $entries, ?UpsertOptions $options = null): array { $encodedEntries = array_map( function (array $entry) use ($options) { diff --git a/Couchbase/CollectionInterface.php b/Couchbase/CollectionInterface.php index d83d9a7c..316070bc 100644 --- a/Couchbase/CollectionInterface.php +++ b/Couchbase/CollectionInterface.php @@ -28,33 +28,33 @@ public function scopeName(): string; public function name(): string; - public function get(string $id, GetOptions $options = null): GetResult; + public function get(string $id, ?GetOptions $options = null): GetResult; - public function exists(string $id, ExistsOptions $options = null): ExistsResult; + public function exists(string $id, ?ExistsOptions $options = null): ExistsResult; - public function getAndLock(string $id, int $lockTimeSeconds, GetAndLockOptions $options = null): GetResult; + public function getAndLock(string $id, int $lockTimeSeconds, ?GetAndLockOptions $options = null): GetResult; - public function getAndTouch(string $id, $expiry, GetAndTouchOptions $options = null): GetResult; + public function getAndTouch(string $id, $expiry, ?GetAndTouchOptions $options = null): GetResult; - public function getAnyReplica(string $id, GetAnyReplicaOptions $options = null): GetReplicaResult; + public function getAnyReplica(string $id, ?GetAnyReplicaOptions $options = null): GetReplicaResult; - public function getAllReplicas(string $id, GetAllReplicasOptions $options = null): array; + public function getAllReplicas(string $id, ?GetAllReplicasOptions $options = null): array; - public function upsert(string $id, $value, UpsertOptions $options = null): MutationResult; + public function upsert(string $id, $value, ?UpsertOptions $options = null): MutationResult; - public function insert(string $id, $value, InsertOptions $options = null): MutationResult; + public function insert(string $id, $value, ?InsertOptions $options = null): MutationResult; - public function replace(string $id, $value, ReplaceOptions $options = null): MutationResult; + public function replace(string $id, $value, ?ReplaceOptions $options = null): MutationResult; - public function remove(string $id, RemoveOptions $options = null): MutationResult; + public function remove(string $id, ?RemoveOptions $options = null): MutationResult; - public function unlock(string $id, string $cas, UnlockOptions $options = null): Result; + public function unlock(string $id, string $cas, ?UnlockOptions $options = null): Result; - public function touch(string $id, $expiry, TouchOptions $options = null): MutationResult; + public function touch(string $id, $expiry, ?TouchOptions $options = null): MutationResult; - public function lookupIn(string $id, array $specs, LookupInOptions $options = null): LookupInResult; + public function lookupIn(string $id, array $specs, ?LookupInOptions $options = null): LookupInResult; - public function mutateIn(string $id, array $specs, MutateInOptions $options = null): MutateInResult; + public function mutateIn(string $id, array $specs, ?MutateInOptions $options = null): MutateInResult; public function binary(): BinaryCollectionInterface; } diff --git a/Couchbase/Exception/CouchbaseException.php b/Couchbase/Exception/CouchbaseException.php index c8911ed2..f6f7dc89 100644 --- a/Couchbase/Exception/CouchbaseException.php +++ b/Couchbase/Exception/CouchbaseException.php @@ -30,7 +30,7 @@ class CouchbaseException extends Exception { private ?array $context; - public function __construct($message = "", $code = 0, Throwable $previous = null, array $context = null) + public function __construct($message = "", $code = 0, ?Throwable $previous = null, ?array $context = null) { parent::__construct($message, $code, $previous); $this->context = $context; diff --git a/Couchbase/GeoDistanceSearchQuery.php b/Couchbase/GeoDistanceSearchQuery.php index 45ac8776..86cbd731 100644 --- a/Couchbase/GeoDistanceSearchQuery.php +++ b/Couchbase/GeoDistanceSearchQuery.php @@ -42,7 +42,7 @@ class GeoDistanceSearchQuery implements JsonSerializable, SearchQuery * * @since 4.0.0 */ - public function __construct(float $longitude, float $latitude, string $distance = null) + public function __construct(float $longitude, float $latitude, ?string $distance = null) { $this->longitude = $longitude; $this->latitude = $latitude; @@ -59,7 +59,7 @@ public function __construct(float $longitude, float $latitude, string $distance * @return GeoDistanceSearchQuery * @since 4.1.7 */ - public static function build(float $longitude, float $latitude, string $distance = null): GeoDistanceSearchQuery + public static function build(float $longitude, float $latitude, ?string $distance = null): GeoDistanceSearchQuery { return new GeoDistanceSearchQuery($longitude, $latitude, $distance); } diff --git a/Couchbase/Management/AnalyticsIndexManager.php b/Couchbase/Management/AnalyticsIndexManager.php index c44385c3..2ed9470e 100644 --- a/Couchbase/Management/AnalyticsIndexManager.php +++ b/Couchbase/Management/AnalyticsIndexManager.php @@ -47,7 +47,7 @@ public function __construct($core) * * @since 4.2.4 */ - public function createDataverse(string $dataverseName, CreateAnalyticsDataverseOptions $options = null): void + public function createDataverse(string $dataverseName, ?CreateAnalyticsDataverseOptions $options = null): void { Extension\analyticsDataverseCreate($this->core, $dataverseName, CreateAnalyticsDataverseOptions::export($options)); } @@ -60,7 +60,7 @@ public function createDataverse(string $dataverseName, CreateAnalyticsDataverseO * * @since 4.2.4 */ - public function dropDataverse(string $dataverseName, DropAnalyticsDataverseOptions $options = null): void + public function dropDataverse(string $dataverseName, ?DropAnalyticsDataverseOptions $options = null): void { Extension\analyticsDataverseDrop($this->core, $dataverseName, DropAnalyticsDataverseOptions::export($options)); } @@ -74,7 +74,7 @@ public function dropDataverse(string $dataverseName, DropAnalyticsDataverseOptio * * @since 4.2.4 */ - public function createDataset(string $datasetName, string $bucketName, CreateAnalyticsDatasetOptions $options = null): void + public function createDataset(string $datasetName, string $bucketName, ?CreateAnalyticsDatasetOptions $options = null): void { Extension\analyticsDatasetCreate($this->core, $datasetName, $bucketName, CreateAnalyticsDatasetOptions::export($options)); } @@ -87,7 +87,7 @@ public function createDataset(string $datasetName, string $bucketName, CreateAna * * @since 4.2.4 */ - public function dropDataset(string $datasetName, DropAnalyticsDatasetOptions $options = null): void + public function dropDataset(string $datasetName, ?DropAnalyticsDatasetOptions $options = null): void { Extension\analyticsDatasetDrop($this->core, $datasetName, DropAnalyticsDatasetOptions::export($options)); } @@ -100,7 +100,7 @@ public function dropDataset(string $datasetName, DropAnalyticsDatasetOptions $op * @return array an array of {@link AnalyticsDataset} * @since 4.2.4 */ - public function getAllDatasets(GetAllAnalyticsDatasetsOptions $options = null): array + public function getAllDatasets(?GetAllAnalyticsDatasetsOptions $options = null): array { $result = Extension\analyticsDatasetGetAll($this->core, GetAllAnalyticsDatasetsOptions::export($options)); $datasets = []; @@ -120,7 +120,7 @@ public function getAllDatasets(GetAllAnalyticsDatasetsOptions $options = null): * * @since 4.2.4 */ - public function createIndex(string $datasetName, string $indexName, array $fields, CreateAnalyticsIndexOptions $options = null): void + public function createIndex(string $datasetName, string $indexName, array $fields, ?CreateAnalyticsIndexOptions $options = null): void { Extension\analyticsIndexCreate($this->core, $datasetName, $indexName, $fields, CreateAnalyticsIndexOptions::export($options)); } @@ -134,7 +134,7 @@ public function createIndex(string $datasetName, string $indexName, array $field * * @since 4.2.4 */ - public function dropIndex(string $datasetName, string $indexName, DropAnalyticsIndexOptions $options = null): void + public function dropIndex(string $datasetName, string $indexName, ?DropAnalyticsIndexOptions $options = null): void { Extension\analyticsIndexDrop($this->core, $datasetName, $indexName, DropAnalyticsIndexOptions::export($options)); } @@ -147,7 +147,7 @@ public function dropIndex(string $datasetName, string $indexName, DropAnalyticsI * @return array array of {@link AnalyticsIndex} * @since 4.2.4 */ - public function getAllIndexes(GetAllAnalyticsIndexesOptions $options = null): array + public function getAllIndexes(?GetAllAnalyticsIndexesOptions $options = null): array { $result = Extension\analyticsIndexGetAll($this->core, GetAllAnalyticsIndexesOptions::export($options)); $indexes = []; @@ -164,7 +164,7 @@ public function getAllIndexes(GetAllAnalyticsIndexesOptions $options = null): ar * * @since 4.2.4 */ - public function connectLink(ConnectAnalyticsLinkOptions $options = null): void + public function connectLink(?ConnectAnalyticsLinkOptions $options = null): void { Extension\analyticsLinkConnect($this->core, ConnectAnalyticsLinkOptions::export($options)); } @@ -176,7 +176,7 @@ public function connectLink(ConnectAnalyticsLinkOptions $options = null): void * * @since 4.2.4 */ - public function disconnectLink(DisconnectAnalyticsLinkOptions $options = null): void + public function disconnectLink(?DisconnectAnalyticsLinkOptions $options = null): void { Extension\analyticsLinkDisconnect($this->core, DisconnectAnalyticsLinkOptions::export($options)); } @@ -190,7 +190,7 @@ public function disconnectLink(DisconnectAnalyticsLinkOptions $options = null): * and values are an associative array of datasets to number of pending mutations. * @since 4.2.4 */ - public function getPendingMutations(GetAnalyticsPendingMutationsOptions $options = null): array + public function getPendingMutations(?GetAnalyticsPendingMutationsOptions $options = null): array { $results = Extension\analyticsPendingMutationsGet($this->core, GetAnalyticsPendingMutationsOptions::export($options)); @@ -209,7 +209,7 @@ public function getPendingMutations(GetAnalyticsPendingMutationsOptions $options * * @since 4.2.4 */ - public function createLink(AnalyticsLink $link, CreateAnalyticsLinkOptions $options = null): void + public function createLink(AnalyticsLink $link, ?CreateAnalyticsLinkOptions $options = null): void { Extension\analyticsLinkCreate($this->core, $link->export(), CreateAnalyticsLinkOptions::export($options)); } @@ -226,7 +226,7 @@ public function createLink(AnalyticsLink $link, CreateAnalyticsLinkOptions $opti * * @since 4.2.4 */ - public function replaceLink(AnalyticsLink $link, ReplaceAnalyticsLinkOptions $options = null): void + public function replaceLink(AnalyticsLink $link, ?ReplaceAnalyticsLinkOptions $options = null): void { Extension\analyticsLinkReplace($this->core, $link->export(), ReplaceAnalyticsLinkOptions::export($options)); } @@ -240,7 +240,7 @@ public function replaceLink(AnalyticsLink $link, ReplaceAnalyticsLinkOptions $op * * @since 4.2.4 */ - public function dropLink(string $linkName, string $dataverseName, DropAnalyticsLinkOptions $options = null): void + public function dropLink(string $linkName, string $dataverseName, ?DropAnalyticsLinkOptions $options = null): void { Extension\analyticsLinkDrop($this->core, $linkName, $dataverseName, DropAnalyticsLinkOptions::export($options)); } @@ -256,7 +256,7 @@ public function dropLink(string $linkName, string $dataverseName, DropAnalyticsL * @return array array of {@link CouchbaseRemoteAnalyticsLink}, {@link S3ExternalAnalyticsLink}, or {@link AzureBlobExternalAnalyticsLink} * @since 4.2.4 */ - public function getLinks(GetAnalyticsLinksOptions $options = null): array + public function getLinks(?GetAnalyticsLinksOptions $options = null): array { $result = Extension\analyticsLinkGetAll($this->core, GetAnalyticsLinksOptions::export($options)); $links = []; diff --git a/Couchbase/Management/BucketManager.php b/Couchbase/Management/BucketManager.php index 2222d765..fb238864 100644 --- a/Couchbase/Management/BucketManager.php +++ b/Couchbase/Management/BucketManager.php @@ -46,7 +46,7 @@ public function __construct($core) * @param CreateBucketOptions|null $options the options to use when creating the bucket. * @since 4.0.0 */ - public function createBucket(BucketSettings $settings, CreateBucketOptions $options = null) + public function createBucket(BucketSettings $settings, ?CreateBucketOptions $options = null) { Extension\bucketCreate($this->core, BucketSettings::export($settings), CreateBucketOptions::export($options)); } @@ -58,7 +58,7 @@ public function createBucket(BucketSettings $settings, CreateBucketOptions $opti * @param UpdateBucketOptions|null $options the options to use when updating the bucket. * @since 4.0.0 */ - public function updateBucket(BucketSettings $settings, UpdateBucketOptions $options = null) + public function updateBucket(BucketSettings $settings, ?UpdateBucketOptions $options = null) { Extension\bucketUpdate($this->core, BucketSettings::export($settings), UpdateBucketOptions::export($options)); } @@ -82,7 +82,7 @@ public function removeBucket(string $name) * @param DropBucketOptions|null $options the options to use when dropping the bucket. * @since 4.0.0 */ - public function dropBucket(string $name, DropBucketOptions $options = null) + public function dropBucket(string $name, ?DropBucketOptions $options = null) { Extension\bucketDrop($this->core, $name, DropBucketOptions::export($options)); } @@ -94,7 +94,7 @@ public function dropBucket(string $name, DropBucketOptions $options = null) * @param GetBucketOptions|null $options the options to use when getting the bucket. * @since 4.0.0 */ - public function getBucket(string $name, GetBucketOptions $options = null): BucketSettings + public function getBucket(string $name, ?GetBucketOptions $options = null): BucketSettings { $result = Extension\bucketGet($this->core, $name, GetBucketOptions::export($options)); return BucketSettings::import($result); @@ -107,7 +107,7 @@ public function getBucket(string $name, GetBucketOptions $options = null): Bucke * * @since 4.0.0 */ - public function getAllBuckets(GetAllBucketsOptions $options = null): array + public function getAllBuckets(?GetAllBucketsOptions $options = null): array { $result = Extension\bucketGetAll($this->core, GetAllBucketsOptions::export($options)); $buckets = []; @@ -124,7 +124,7 @@ public function getAllBuckets(GetAllBucketsOptions $options = null): array * @param FlushBucketOptions|null $options the options to use when flushing the bucket. * @since 4.0.0 */ - public function flush(string $name, FlushBucketOptions $options = null) + public function flush(string $name, ?FlushBucketOptions $options = null) { Extension\bucketFlush($this->core, $name, FlushBucketOptions::export($options)); } diff --git a/Couchbase/Management/BucketManagerInterface.php b/Couchbase/Management/BucketManagerInterface.php index f4a6b04f..1e15ceaf 100644 --- a/Couchbase/Management/BucketManagerInterface.php +++ b/Couchbase/Management/BucketManagerInterface.php @@ -1,18 +1,36 @@ core, $this->bucketName, GetAllScopesOptions::export($options)); $scopes = []; @@ -61,7 +61,7 @@ public function getAllScopes(GetAllScopesOptions $options = null): array * @param CreateScopeOptions|null $options the options to use when creating a scope * @since 4.1.3 */ - public function createScope(string $name, CreateScopeOptions $options = null) + public function createScope(string $name, ?CreateScopeOptions $options = null) { Extension\scopeCreate($this->core, $this->bucketName, $name, CreateScopeOptions::export($options)); } @@ -73,7 +73,7 @@ public function createScope(string $name, CreateScopeOptions $options = null) * @param DropScopeOptions|null $options the options to use when dropping a scope * @since 4.1.3 */ - public function dropScope(string $name, DropScopeOptions $options = null) + public function dropScope(string $name, ?DropScopeOptions $options = null) { Extension\scopeDrop($this->core, $this->bucketName, $name, DropScopeOptions::export($options)); } @@ -142,7 +142,7 @@ public function dropCollection($scopeName, $collectionName = null, $options = nu * @param UpdateCollectionOptions|null $options The options to use when updating the collection * @since 4.1.6 */ - public function updateCollection(string $scopeName, string $collectionName, UpdateCollectionSettings $settings, UpdateCollectionOptions $options = null) + public function updateCollection(string $scopeName, string $collectionName, UpdateCollectionSettings $settings, ?UpdateCollectionOptions $options = null) { Extension\collectionUpdate($this->core, $this->bucketName, $scopeName, $collectionName, UpdateCollectionSettings::export($settings), UpdateBucketOptions::export($options)); } diff --git a/Couchbase/Management/CollectionManagerInterface.php b/Couchbase/Management/CollectionManagerInterface.php index 87c62e1d..5b846cd8 100644 --- a/Couchbase/Management/CollectionManagerInterface.php +++ b/Couchbase/Management/CollectionManagerInterface.php @@ -1,18 +1,34 @@ checkOptions($exported); @@ -82,7 +82,7 @@ function (array $response) { * @throws InvalidArgumentException * @since 4.1.2 */ - public function createIndex(string $indexName, array $keys, CreateQueryIndexOptions $options = null) + public function createIndex(string $indexName, array $keys, ?CreateQueryIndexOptions $options = null) { $exported = CreateQueryIndexOptions::export($options); $this->checkOptions($exported); @@ -97,7 +97,7 @@ public function createIndex(string $indexName, array $keys, CreateQueryIndexOpti * @throws InvalidArgumentException * @since 4.1.2 */ - public function createPrimaryIndex(CreateQueryPrimaryIndexOptions $options = null) + public function createPrimaryIndex(?CreateQueryPrimaryIndexOptions $options = null) { $exported = CreateQueryPrimaryIndexOptions::export($options); $this->checkOptions($exported); @@ -113,7 +113,7 @@ public function createPrimaryIndex(CreateQueryPrimaryIndexOptions $options = nul * @throws InvalidArgumentException * @since 4.1.2 */ - public function dropIndex(string $indexName, DropQueryIndexOptions $options = null) + public function dropIndex(string $indexName, ?DropQueryIndexOptions $options = null) { $exported = DropQueryIndexOptions::export($options); $this->checkOptions($exported); @@ -128,7 +128,7 @@ public function dropIndex(string $indexName, DropQueryIndexOptions $options = nu * @throws InvalidArgumentException * @since 4.1.2 */ - public function dropPrimaryIndex(DropQueryPrimaryIndexOptions $options = null) + public function dropPrimaryIndex(?DropQueryPrimaryIndexOptions $options = null) { $exported = DropQueryPrimaryIndexOptions::export($options); $this->checkOptions($exported); @@ -143,7 +143,7 @@ public function dropPrimaryIndex(DropQueryPrimaryIndexOptions $options = null) * @throws InvalidArgumentException * @since 4.1.2 */ - public function buildDeferredIndexes(BuildQueryIndexesOptions $options = null) + public function buildDeferredIndexes(?BuildQueryIndexesOptions $options = null) { $exported = BuildQueryIndexesOptions::export($options); $this->checkOptions($exported); @@ -160,7 +160,7 @@ public function buildDeferredIndexes(BuildQueryIndexesOptions $options = null) * @throws UnambiguousTimeoutException|InvalidArgumentException * @since 4.1.2 */ - public function watchIndexes(array $indexNames, int $timeoutMilliseconds, WatchQueryIndexesOptions $options = null) + public function watchIndexes(array $indexNames, int $timeoutMilliseconds, ?WatchQueryIndexesOptions $options = null) { $exported = WatchQueryIndexesOptions::export($options); $this->checkOptions($exported); diff --git a/Couchbase/Management/CollectionQueryIndexManagerInterface.php b/Couchbase/Management/CollectionQueryIndexManagerInterface.php index da168621..ad294559 100644 --- a/Couchbase/Management/CollectionQueryIndexManagerInterface.php +++ b/Couchbase/Management/CollectionQueryIndexManagerInterface.php @@ -1,20 +1,36 @@ name = $name; $this->scopeName = $scopeName; @@ -50,7 +50,7 @@ public function __construct(string $name, string $scopeName, int $maxExpiry = nu * @return CollectionSpec * @since 4.1.3 */ - public static function build(string $name, string $scopeName, int $maxExpiry = null, bool $history = null): CollectionSpec + public static function build(string $name, string $scopeName, ?int $maxExpiry = null, ?bool $history = null): CollectionSpec { return new CollectionSpec($name, $scopeName, $maxExpiry, $history); } diff --git a/Couchbase/Management/CreateCollectionSettings.php b/Couchbase/Management/CreateCollectionSettings.php index 834551f8..1863da6e 100644 --- a/Couchbase/Management/CreateCollectionSettings.php +++ b/Couchbase/Management/CreateCollectionSettings.php @@ -31,7 +31,7 @@ class CreateCollectionSettings /** * @throws InvalidArgumentException */ - public function __construct(int $maxExpiry = null, bool $history = null) + public function __construct(?int $maxExpiry = null, ?bool $history = null) { if ($maxExpiry && $maxExpiry < -1) { throw new InvalidArgumentException("Collection max expiry must be greater than or equal to -1."); @@ -43,7 +43,7 @@ public function __construct(int $maxExpiry = null, bool $history = null) /** * @throws InvalidArgumentException */ - public static function build(int $maxExpiry = null, bool $history = null): CreateCollectionSettings + public static function build(?int $maxExpiry = null, ?bool $history = null): CreateCollectionSettings { return new CreateCollectionSettings($maxExpiry, $history); } diff --git a/Couchbase/Management/QueryIndexManager.php b/Couchbase/Management/QueryIndexManager.php index b7cbe0a4..d1657ee5 100644 --- a/Couchbase/Management/QueryIndexManager.php +++ b/Couchbase/Management/QueryIndexManager.php @@ -50,7 +50,7 @@ public function __construct($core) * @return array * @since 4.0.0 */ - public function getAllIndexes(string $bucketName, GetAllQueryIndexesOptions $options = null): array + public function getAllIndexes(string $bucketName, ?GetAllQueryIndexesOptions $options = null): array { $responses = Extension\queryIndexGetAll($this->core, $bucketName, GetAllQueryIndexesOptions::export($options)); return array_map( @@ -71,7 +71,7 @@ function (array $response) { * * @since 4.0.0 */ - public function createIndex(string $bucketName, string $indexName, array $keys, CreateQueryIndexOptions $options = null) + public function createIndex(string $bucketName, string $indexName, array $keys, ?CreateQueryIndexOptions $options = null) { Extension\queryIndexCreate($this->core, $bucketName, $indexName, $keys, CreateQueryIndexOptions::export($options)); } @@ -84,7 +84,7 @@ public function createIndex(string $bucketName, string $indexName, array $keys, * * @since 4.0.0 */ - public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOptions $options = null) + public function createPrimaryIndex(string $bucketName, ?CreateQueryPrimaryIndexOptions $options = null) { Extension\queryIndexCreatePrimary($this->core, $bucketName, CreateQueryPrimaryIndexOptions::export($options)); } @@ -98,7 +98,7 @@ public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOp * * @since 4.0.0 */ - public function dropIndex(string $bucketName, string $indexName, DropQueryIndexOptions $options = null) + public function dropIndex(string $bucketName, string $indexName, ?DropQueryIndexOptions $options = null) { Extension\queryIndexDrop($this->core, $bucketName, $indexName, DropQueryIndexOptions::export($options)); } @@ -111,7 +111,7 @@ public function dropIndex(string $bucketName, string $indexName, DropQueryIndexO * * @since 4.0.0 */ - public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOptions $options = null) + public function dropPrimaryIndex(string $bucketName, ?DropQueryPrimaryIndexOptions $options = null) { Extension\queryIndexDropPrimary($this->core, $bucketName, DropQueryPrimaryIndexOptions::export($options)); } @@ -124,7 +124,7 @@ public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOption * * @since 4.0.0 */ - public function buildDeferredIndexes(string $bucketName, BuildQueryIndexesOptions $options = null) + public function buildDeferredIndexes(string $bucketName, ?BuildQueryIndexesOptions $options = null) { Extension\queryIndexBuildDeferred($this->core, $bucketName, BuildQueryIndexesOptions::export($options)); } @@ -140,7 +140,7 @@ public function buildDeferredIndexes(string $bucketName, BuildQueryIndexesOption * @throws UnambiguousTimeoutException * @since 4.0.0 */ - public function watchIndexes(string $bucketName, array $indexNames, int $timeoutMilliseconds, WatchQueryIndexesOptions $options = null) + public function watchIndexes(string $bucketName, array $indexNames, int $timeoutMilliseconds, ?WatchQueryIndexesOptions $options = null) { $exported = WatchQueryIndexesOptions::export($options); if (array_key_exists("watchPrimary", $exported) && $exported["watchPrimary"]) { diff --git a/Couchbase/Management/QueryIndexManagerInterface.php b/Couchbase/Management/QueryIndexManagerInterface.php index edec914a..431e76df 100644 --- a/Couchbase/Management/QueryIndexManagerInterface.php +++ b/Couchbase/Management/QueryIndexManagerInterface.php @@ -1,20 +1,38 @@ core, $this->bucketName, $this->scopeName, $indexName, GetSearchIndexOptions::export($options)); @@ -59,7 +59,7 @@ public function getIndex(string $indexName, GetSearchIndexOptions $options = nul * * @since 4.1.7 */ - public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array + public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): array { $result = Extension\scopeSearchIndexGetAll($this->core, $this->bucketName, $this->scopeName, GetAllSearchIndexesOptions::export($options)); $indexes = []; @@ -77,7 +77,7 @@ public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array * * @since 4.1.7 */ - public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptions $options = null) + public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOptions $options = null) { Extension\scopeSearchIndexUpsert($this->core, $this->bucketName, $this->scopeName, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); } @@ -90,7 +90,7 @@ public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptio * * @since 4.1.7 */ - public function dropIndex(string $name, DropSearchIndexOptions $options = null) + public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) { Extension\scopeSearchIndexDrop($this->core, $this->bucketName, $this->scopeName, $name, DropSearchIndexOptions::export($options)); } @@ -104,7 +104,7 @@ public function dropIndex(string $name, DropSearchIndexOptions $options = null) * @return int * @since 4.1.7 */ - public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchIndexOptions $options = null): int + public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchIndexOptions $options = null): int { $result = Extension\scopeSearchIndexGetDocumentsCount($this->core, $this->bucketName, $this->scopeName, $indexName, GetIndexedSearchIndexOptions::export($options)); return $result['count']; @@ -118,7 +118,7 @@ public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchInde * * @since 4.1.7 */ - public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $options = null) + public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $options = null) { Extension\scopeSearchIndexIngestPause($this->core, $this->bucketName, $this->scopeName, $indexName, PauseIngestSearchIndexOptions::export($options)); } @@ -131,7 +131,7 @@ public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $op * * @since 4.1.7 */ - public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $options = null) + public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions $options = null) { Extension\scopeSearchIndexIngestResume($this->core, $this->bucketName, $this->scopeName, $indexName, ResumeIngestSearchIndexOptions::export($options)); } @@ -144,7 +144,7 @@ public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $ * * @since 4.1.7 */ - public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions $options = null) + public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOptions $options = null) { Extension\scopeSearchIndexQueryingAllow($this->core, $this->bucketName, $this->scopeName, $indexName, AllowQueryingSearchIndexOptions::export($options)); } @@ -157,7 +157,7 @@ public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions * * @since 4.1.7 */ - public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexOptions $options = null) + public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndexOptions $options = null) { Extension\scopeSearchIndexQueryingDisallow($this->core, $this->bucketName, $this->scopeName, $indexName, DisallowQueryingSearchIndexOptions::export($options)); } @@ -170,7 +170,7 @@ public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexO * * @since 4.1.7 */ - public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $options = null) + public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $options = null) { Extension\scopeSearchIndexPlanFreeze($this->core, $this->bucketName, $this->scopeName, $indexName, FreezePlanSearchIndexOptions::export($options)); } @@ -183,7 +183,7 @@ public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $opti * * @since 4.1.7 */ - public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $options = null) + public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions $options = null) { Extension\scopeSearchIndexPlanUnfreeze($this->core, $this->bucketName, $this->scopeName, $indexName, UnfreezePlanSearchIndexOptions::export($options)); } @@ -198,7 +198,7 @@ public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $ * @return array * @since 4.1.7 */ - public function analyzeDocument(string $indexName, $document, AnalyzeDocumentOptions $options = null): array + public function analyzeDocument(string $indexName, $document, ?AnalyzeDocumentOptions $options = null): array { $result = Extension\scopeSearchIndexDocumentAnalyze($this->core, $this->bucketName, $this->scopeName, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); return json_decode($result["analysis"], true); diff --git a/Couchbase/Management/ScopeSearchIndexManagerInterface.php b/Couchbase/Management/ScopeSearchIndexManagerInterface.php index d25c2e32..6285752e 100644 --- a/Couchbase/Management/ScopeSearchIndexManagerInterface.php +++ b/Couchbase/Management/ScopeSearchIndexManagerInterface.php @@ -1,30 +1,48 @@ core, $indexName, GetSearchIndexOptions::export($options)); @@ -66,7 +66,7 @@ public function getIndex(string $indexName, GetSearchIndexOptions $options = nul * * @since 4.1.5 */ - public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array + public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): array { $result = Extension\searchIndexGetAll($this->core, GetAllSearchIndexesOptions::export($options)); $indexes = []; @@ -84,7 +84,7 @@ public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array * * @since 4.1.5 */ - public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptions $options = null) + public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOptions $options = null) { Extension\searchIndexUpsert($this->core, SearchIndex::export($indexDefinition), UpsertSearchIndexOptions::export($options)); } @@ -97,7 +97,7 @@ public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptio * * @since 4.1.5 */ - public function dropIndex(string $name, DropSearchIndexOptions $options = null) + public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) { Extension\searchIndexDrop($this->core, $name, DropSearchIndexOptions::export($options)); } @@ -111,7 +111,7 @@ public function dropIndex(string $name, DropSearchIndexOptions $options = null) * * @since 4.1.5 */ - public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchIndexOptions $options = null): int + public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchIndexOptions $options = null): int { $result = Extension\searchIndexGetDocumentsCount($this->core, $indexName, GetIndexedSearchIndexOptions::export($options)); return $result['count']; @@ -125,7 +125,7 @@ public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchInde * * @since 4.1.5 */ - public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $options = null) + public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $options = null) { Extension\searchIndexIngestPause($this->core, $indexName, PauseIngestSearchIndexOptions::export($options)); } @@ -138,7 +138,7 @@ public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $op * * @since 4.1.5 */ - public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $options = null) + public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions $options = null) { Extension\searchIndexIngestResume($this->core, $indexName, ResumeIngestSearchIndexOptions::export($options)); } @@ -151,7 +151,7 @@ public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $ * * @since 4.1.5 */ - public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions $options = null) + public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOptions $options = null) { Extension\searchIndexQueryingAllow($this->core, $indexName, AllowQueryingSearchIndexOptions::export($options)); } @@ -164,7 +164,7 @@ public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions * * @since 4.1.5 */ - public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexOptions $options = null) + public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndexOptions $options = null) { Extension\searchIndexQueryingDisallow($this->core, $indexName, DisallowQueryingSearchIndexOptions::export($options)); } @@ -177,7 +177,7 @@ public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexO * * @since 4.1.5 */ - public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $options = null) + public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $options = null) { Extension\searchIndexPlanFreeze($this->core, $indexName, FreezePlanSearchIndexOptions::export($options)); } @@ -189,7 +189,7 @@ public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $opti * * @since 4.1.5 */ - public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $options = null) + public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions $options = null) { Extension\searchIndexPlanUnfreeze($this->core, $indexName, UnfreezePlanSearchIndexOptions::export($options)); } @@ -204,7 +204,7 @@ public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $ * * @since 4.1.5 */ - public function analyzeDocument(string $indexName, $document, AnalyzeDocumentOptions $options = null): array + public function analyzeDocument(string $indexName, $document, ?AnalyzeDocumentOptions $options = null): array { $result = Extension\searchIndexDocumentAnalyze($this->core, $indexName, json_encode($document), AnalyzeDocumentOptions::export($options)); return json_decode($result["analysis"], true); diff --git a/Couchbase/Management/SearchIndexManagerInterface.php b/Couchbase/Management/SearchIndexManagerInterface.php index 2296e6b0..4700d30f 100644 --- a/Couchbase/Management/SearchIndexManagerInterface.php +++ b/Couchbase/Management/SearchIndexManagerInterface.php @@ -1,30 +1,46 @@ core, $name, GetUserOptions::export($options)); return UserAndMetadata::import($result); @@ -60,7 +60,7 @@ public function getUser(string $name, GetUserOptions $options = null): UserAndMe * @return array * @since 4.0.0 */ - public function getAllUsers(GetAllUsersOptions $options = null): array + public function getAllUsers(?GetAllUsersOptions $options = null): array { $result = Extension\userGetAll($this->core, GetAllUsersOptions::export($options)); $users = []; @@ -78,7 +78,7 @@ public function getAllUsers(GetAllUsersOptions $options = null): array * @param UpsertUserOptions|null $options the options to use when upserting the user. * @since 4.0.0 */ - public function upsertUser(User $user, UpsertUserOptions $options = null) + public function upsertUser(User $user, ?UpsertUserOptions $options = null) { Extension\userUpsert($this->core, User::export($user), UpsertUserOptions::export($options)); } @@ -90,7 +90,7 @@ public function upsertUser(User $user, UpsertUserOptions $options = null) * @param DropUserOptions|null $options the options to use when dropping the user. * @since 4.0.0 */ - public function dropUser(string $name, DropUserOptions $options = null) + public function dropUser(string $name, ?DropUserOptions $options = null) { Extension\userDrop($this->core, $name, DropUserOptions::export($options)); } @@ -103,7 +103,7 @@ public function dropUser(string $name, DropUserOptions $options = null) * @see \Couchbase\Management\RoleAndDescription * @since 4.0.0 */ - public function getRoles(GetRolesOptions $options = null): array + public function getRoles(?GetRolesOptions $options = null): array { $result = Extension\roleGetAll($this->core, GetRolesOptions::export($options)); foreach ($result as $role) { @@ -121,7 +121,7 @@ public function getRoles(GetRolesOptions $options = null): array * @return Group * @since 4.0.0 */ - public function getGroup(string $name, GetGroupOptions $options = null): Group + public function getGroup(string $name, ?GetGroupOptions $options = null): Group { $result = Extension\groupGet($this->core, $name, GetGroupOptions::export($options)); return Group::import($result); @@ -135,7 +135,7 @@ public function getGroup(string $name, GetGroupOptions $options = null): Group * @see \Couchbase\Management\Group * @since 4.0.0 */ - public function getAllGroups(GetAllGroupsOptions $options = null): array + public function getAllGroups(?GetAllGroupsOptions $options = null): array { $result = Extension\groupGetAll($this->core, GetAllGroupsOptions::export($options)); $groups = []; @@ -153,7 +153,7 @@ public function getAllGroups(GetAllGroupsOptions $options = null): array * @param UpsertGroupOptions|null $options the options to use when upserting the group. * @since 4.0.0 */ - public function upsertGroup(Group $group, UpsertGroupOptions $options = null) + public function upsertGroup(Group $group, ?UpsertGroupOptions $options = null) { Extension\groupUpsert($this->core, Group::export($group), UpsertGroupOptions::export($options)); } @@ -165,7 +165,7 @@ public function upsertGroup(Group $group, UpsertGroupOptions $options = null) * @param DropGroupOptions|null $options the options to use when dropping the group. * @since 4.0.0 */ - public function dropGroup(string $name, DropGroupOptions $options = null) + public function dropGroup(string $name, ?DropGroupOptions $options = null) { Extension\groupDrop($this->core, $name, DropGroupOptions::export($options)); } @@ -176,7 +176,7 @@ public function dropGroup(string $name, DropGroupOptions $options = null) * @param ChangePasswordOptions|null $options the options to use when changing the password of the user * @since 4.1.1 */ - public function changePassword(string $newPassword, ChangePasswordOptions $options = null) + public function changePassword(string $newPassword, ?ChangePasswordOptions $options = null) { Extension\passwordChange($this->core, $newPassword, ChangePasswordOptions::export($options)); } diff --git a/Couchbase/Management/UserManagerInterface.php b/Couchbase/Management/UserManagerInterface.php index 21e72ebe..22630aaa 100644 --- a/Couchbase/Management/UserManagerInterface.php +++ b/Couchbase/Management/UserManagerInterface.php @@ -1,26 +1,44 @@ $name, diff --git a/Couchbase/Protostellar/BinaryCollection.php b/Couchbase/Protostellar/BinaryCollection.php index d66a6a1f..cbe16b6f 100644 --- a/Couchbase/Protostellar/BinaryCollection.php +++ b/Couchbase/Protostellar/BinaryCollection.php @@ -65,7 +65,7 @@ public function name(): string /** * @throws InvalidArgumentException */ - public function append(string $key, string $value, AppendOptions $options = null): MutationResult + public function append(string $key, string $value, ?AppendOptions $options = null): MutationResult { $exportedOptions = AppendOptions::export($options); $request = RequestFactory::makeRequest( @@ -83,7 +83,7 @@ public function append(string $key, string $value, AppendOptions $options = null /** * @throws InvalidArgumentException */ - public function prepend(string $key, string $value, PrependOptions $options = null): MutationResult + public function prepend(string $key, string $value, ?PrependOptions $options = null): MutationResult { $exportedOptions = PrependOptions::export($options); $request = RequestFactory::makeRequest( @@ -101,7 +101,7 @@ public function prepend(string $key, string $value, PrependOptions $options = nu /** * @throws InvalidArgumentException */ - public function increment(string $key, IncrementOptions $options = null): CounterResult + public function increment(string $key, ?IncrementOptions $options = null): CounterResult { $exportedOptions = IncrementOptions::export($options); $request = RequestFactory::makeRequest( @@ -119,7 +119,7 @@ public function increment(string $key, IncrementOptions $options = null): Counte /** * @throws InvalidArgumentException */ - public function decrement(string $key, DecrementOptions $options = null): CounterResult + public function decrement(string $key, ?DecrementOptions $options = null): CounterResult { $exportedOptions = DecrementOptions::export($options); $request = RequestFactory::makeRequest( diff --git a/Couchbase/Protostellar/Bucket.php b/Couchbase/Protostellar/Bucket.php index f7f8d3df..0df37cf2 100644 --- a/Couchbase/Protostellar/Bucket.php +++ b/Couchbase/Protostellar/Bucket.php @@ -66,7 +66,7 @@ public function defaultCollection(): Collection /** * @throws UnsupportedOperationException */ - public function viewQuery(string $designDoc, string $viewName, ViewOptions $options = null): ViewResult + public function viewQuery(string $designDoc, string $viewName, ?ViewOptions $options = null): ViewResult { throw new UnsupportedOperationException("Views are not supported in CNG"); } diff --git a/Couchbase/Protostellar/Cluster.php b/Couchbase/Protostellar/Cluster.php index 3a00a468..3ac26308 100644 --- a/Couchbase/Protostellar/Cluster.php +++ b/Couchbase/Protostellar/Cluster.php @@ -65,7 +65,7 @@ public function bucket(string $name): Bucket /** * @throws InvalidArgumentException */ - public function query(string $statement, QueryOptions $options = null): QueryResult + public function query(string $statement, ?QueryOptions $options = null): QueryResult { $exportedOptions = QueryOptions::export($options); $request = RequestFactory::makeRequest( @@ -81,7 +81,7 @@ public function query(string $statement, QueryOptions $options = null): QueryRes return new QueryResult($finalArray, QueryOptions::getTranscoder($options)); } - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { $exportedOptions = AnalyticsOptions::export($options); $request = RequestFactory::makeRequest( @@ -100,7 +100,7 @@ public function analyticsQuery(string $statement, AnalyticsOptions $options = nu /** * @throws InvalidArgumentException */ - public function searchQuery(string $indexName, SearchQuery $query, SearchOptions $options = null): SearchResult + public function searchQuery(string $indexName, SearchQuery $query, ?SearchOptions $options = null): SearchResult { $exportedOptions = SearchOptions::export($options); $request = RequestFactory::makeRequest( diff --git a/Couchbase/Protostellar/Collection.php b/Couchbase/Protostellar/Collection.php index b4b56c51..420f4342 100644 --- a/Couchbase/Protostellar/Collection.php +++ b/Couchbase/Protostellar/Collection.php @@ -80,7 +80,7 @@ public function name(): string /** * @throws InvalidArgumentException */ - public function upsert(string $key, $document, UpsertOptions $options = null): MutationResult + public function upsert(string $key, $document, ?UpsertOptions $options = null): MutationResult { $exportedOptions = UpsertOptions::export($options); $request = RequestFactory::makeRequest( @@ -98,7 +98,7 @@ public function upsert(string $key, $document, UpsertOptions $options = null): M /** * @throws InvalidArgumentException|DecodingFailureException */ - public function insert(string $key, $document, InsertOptions $options = null): MutationResult + public function insert(string $key, $document, ?InsertOptions $options = null): MutationResult { $exportedOptions = InsertOptions::export($options); $request = RequestFactory::makeRequest( @@ -116,7 +116,7 @@ public function insert(string $key, $document, InsertOptions $options = null): M /** * @throws InvalidArgumentException */ - public function replace(string $key, $document, ReplaceOptions $options = null): MutationResult + public function replace(string $key, $document, ?ReplaceOptions $options = null): MutationResult { $exportedOptions = ReplaceOptions::export($options); $request = RequestFactory::makeRequest( @@ -134,7 +134,7 @@ public function replace(string $key, $document, ReplaceOptions $options = null): /** * @throws InvalidArgumentException */ - public function remove(string $key, RemoveOptions $options = null): MutationResult + public function remove(string $key, ?RemoveOptions $options = null): MutationResult { $exportedOptions = RemoveOptions::export($options); $request = RequestFactory::makeRequest( @@ -149,7 +149,7 @@ public function remove(string $key, RemoveOptions $options = null): MutationResu return KVResponseConverter::convertMutationResult($key, $res); } - public function get(string $key, GetOptions $options = null): GetResult + public function get(string $key, ?GetOptions $options = null): GetResult { $exportedOptions = GetOptions::export($options); $request = RequestFactory::makeRequest( @@ -164,7 +164,7 @@ public function get(string $key, GetOptions $options = null): GetResult return KVResponseConverter::convertGetResult($key, $res, $options); } - public function exists(string $key, ExistsOptions $options = null): ExistsResult + public function exists(string $key, ?ExistsOptions $options = null): ExistsResult { $exportedOptions = ExistsOptions::export($options); $request = RequestFactory::makeRequest( @@ -183,7 +183,7 @@ public function exists(string $key, ExistsOptions $options = null): ExistsResult * @throws ProtocolException * @throws InvalidArgumentException */ - public function getAndTouch(string $key, $expiry, GetAndTouchOptions $options = null): GetResult + public function getAndTouch(string $key, $expiry, ?GetAndTouchOptions $options = null): GetResult { $exportedOptions = GetAndTouchOptions::export($options); $request = RequestFactory::makeRequest( @@ -202,7 +202,7 @@ public function getAndTouch(string $key, $expiry, GetAndTouchOptions $options = * @throws ProtocolException * @throws InvalidArgumentException */ - public function getAndLock(string $key, int $lockTimeSeconds, GetAndLockOptions $options = null): GetResult + public function getAndLock(string $key, int $lockTimeSeconds, ?GetAndLockOptions $options = null): GetResult { $exportedOptions = GetAndLockOptions::export($options); $request = RequestFactory::makeRequest( @@ -220,7 +220,7 @@ public function getAndLock(string $key, int $lockTimeSeconds, GetAndLockOptions /** * @throws ProtocolException */ - public function unlock(string $key, string $cas, UnlockOptions $options = null): Result + public function unlock(string $key, string $cas, ?UnlockOptions $options = null): Result { $exportedOptions = UnlockOptions::export($options); $request = RequestFactory::makeRequest( @@ -235,7 +235,7 @@ public function unlock(string $key, string $cas, UnlockOptions $options = null): return KVResponseConverter::convertUnlockResult($key, $cas); } - public function touch(string $key, $expiry, TouchOptions $options = null): MutationResult + public function touch(string $key, $expiry, ?TouchOptions $options = null): MutationResult { $exportedOptions = TouchOptions::export($options); $request = RequestFactory::makeRequest( @@ -250,7 +250,7 @@ public function touch(string $key, $expiry, TouchOptions $options = null): Mutat return KVResponseConverter::convertTouchResult($key, $res); } - public function lookupIn(string $key, array $specs, LookupInOptions $options = null): LookupInResult + public function lookupIn(string $key, array $specs, ?LookupInOptions $options = null): LookupInResult { $exportedOptions = LookupInOptions::export($options); [$request, $order] = RequestFactory::makeRequest( @@ -268,7 +268,7 @@ public function lookupIn(string $key, array $specs, LookupInOptions $options = n /** * @throws InvalidArgumentException */ - public function mutateIn(string $key, array $specs, MutateInOptions $options = null): MutateInResult + public function mutateIn(string $key, array $specs, ?MutateInOptions $options = null): MutateInResult { $exportedOptions = MutateInOptions::export($options); [$request, $order] = RequestFactory::makeRequest( @@ -286,7 +286,7 @@ public function mutateIn(string $key, array $specs, MutateInOptions $options = n /** * @throws DocumentIrretrievableException */ - public function getAnyReplica(string $key, GetAnyReplicaOptions $options = null): GetReplicaResult + public function getAnyReplica(string $key, ?GetAnyReplicaOptions $options = null): GetReplicaResult { $exportedOptions = GetAnyReplicaOptions::export($options); $request = RequestFactory::makeRequest( @@ -304,7 +304,7 @@ public function getAnyReplica(string $key, GetAnyReplicaOptions $options = null) /** * @throws DocumentNotFoundException */ - public function getAllReplicas(string $key, GetAllReplicasOptions $options = null): array + public function getAllReplicas(string $key, ?GetAllReplicasOptions $options = null): array { $exportedOptions = GetAllReplicasOptions::export($options); $request = RequestFactory::makeRequest( diff --git a/Couchbase/Protostellar/Internal/KV/KVRequestConverter.php b/Couchbase/Protostellar/Internal/KV/KVRequestConverter.php index 172bee4c..9697ed9e 100644 --- a/Couchbase/Protostellar/Internal/KV/KVRequestConverter.php +++ b/Couchbase/Protostellar/Internal/KV/KVRequestConverter.php @@ -1,5 +1,23 @@ $indexName @@ -51,7 +51,7 @@ public static function getGetIndexRequest(string $indexName, string $bucketName return new GetIndexRequest($request); } - public static function getGetAllIndexesRequest(string $bucketName = null, string $scopeName = null): ListIndexesRequest + public static function getGetAllIndexesRequest(?string $bucketName = null, ?string $scopeName = null): ListIndexesRequest { $request = []; if (!is_null($bucketName)) { @@ -63,7 +63,7 @@ public static function getGetAllIndexesRequest(string $bucketName = null, string return new ListIndexesRequest($request); } - public static function getCreateIndexRequest(array $index, string $bucketName = null, string $scopeName = null): CreateIndexRequest + public static function getCreateIndexRequest(array $index, ?string $bucketName = null, ?string $scopeName = null): CreateIndexRequest { $request = [ "name" => $index["name"], @@ -92,7 +92,7 @@ public static function getCreateIndexRequest(array $index, string $bucketName = return new CreateIndexRequest($request); } - public static function getUpdateIndexRequest(array $index, string $bucketName = null, string $scopeName = null): UpdateIndexRequest + public static function getUpdateIndexRequest(array $index, ?string $bucketName = null, ?string $scopeName = null): UpdateIndexRequest { $request = [ "index" => self::getIndex($index) @@ -106,7 +106,7 @@ public static function getUpdateIndexRequest(array $index, string $bucketName = return new UpdateIndexRequest($request); } - public static function getDropIndexRequest(string $indexName, string $bucketName = null, string $scopeName = null): DeleteIndexRequest + public static function getDropIndexRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): DeleteIndexRequest { $request = [ "name" => $indexName @@ -120,7 +120,7 @@ public static function getDropIndexRequest(string $indexName, string $bucketName return new DeleteIndexRequest($request); } - public static function getGetIndexedDocumentCountRequest(string $indexName, string $bucketName = null, string $scopeName = null): GetIndexedDocumentsCountRequest + public static function getGetIndexedDocumentCountRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): GetIndexedDocumentsCountRequest { $request = [ "name" => $indexName @@ -134,7 +134,7 @@ public static function getGetIndexedDocumentCountRequest(string $indexName, stri return new GetIndexedDocumentsCountRequest($request); } - public static function getPauseIngestRequest(string $indexName, string $bucketName = null, string $scopeName = null): PauseIndexIngestRequest + public static function getPauseIngestRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): PauseIndexIngestRequest { $request = [ "name" => $indexName @@ -148,7 +148,7 @@ public static function getPauseIngestRequest(string $indexName, string $bucketNa return new PauseIndexIngestRequest($request); } - public static function getResumeIngestRequest(string $indexName, string $bucketName = null, string $scopeName = null): ResumeIndexIngestRequest + public static function getResumeIngestRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): ResumeIndexIngestRequest { $request = [ "name" => $indexName @@ -162,7 +162,7 @@ public static function getResumeIngestRequest(string $indexName, string $bucketN return new ResumeIndexIngestRequest($request); } - public static function getAllowQueryingRequest(string $indexName, string $bucketName = null, string $scopeName = null): AllowIndexQueryingRequest + public static function getAllowQueryingRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): AllowIndexQueryingRequest { $request = [ "name" => $indexName @@ -176,7 +176,7 @@ public static function getAllowQueryingRequest(string $indexName, string $bucket return new AllowIndexQueryingRequest($request); } - public static function getDisallowQueryingRequest(string $indexName, string $bucketName = null, string $scopeName = null): DisallowIndexQueryingRequest + public static function getDisallowQueryingRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): DisallowIndexQueryingRequest { $request = [ "name" => $indexName @@ -190,7 +190,7 @@ public static function getDisallowQueryingRequest(string $indexName, string $buc return new DisallowIndexQueryingRequest($request); } - public static function getFreezePlanRequest(string $indexName, string $bucketName = null, string $scopeName = null): FreezeIndexPlanRequest + public static function getFreezePlanRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): FreezeIndexPlanRequest { $request = [ "name" => $indexName @@ -204,7 +204,7 @@ public static function getFreezePlanRequest(string $indexName, string $bucketNam return new FreezeIndexPlanRequest($request); } - public static function getUnfreezePlanRequest(string $indexName, string $bucketName = null, string $scopeName = null): UnfreezeIndexPlanRequest + public static function getUnfreezePlanRequest(string $indexName, ?string $bucketName = null, ?string $scopeName = null): UnfreezeIndexPlanRequest { $request = [ "name" => $indexName @@ -218,7 +218,7 @@ public static function getUnfreezePlanRequest(string $indexName, string $bucketN return new UnfreezeIndexPlanRequest($request); } - public static function getAnalyzeDocumentRequest(string $indexName, $document, string $bucketName = null, string $scopeName = null): AnalyzeDocumentRequest + public static function getAnalyzeDocumentRequest(string $indexName, $document, ?string $bucketName = null, ?string $scopeName = null): AnalyzeDocumentRequest { $request = [ "name" => $indexName, diff --git a/Couchbase/Protostellar/Management/BucketManager.php b/Couchbase/Protostellar/Management/BucketManager.php index fc0527fd..008aff6d 100644 --- a/Couchbase/Protostellar/Management/BucketManager.php +++ b/Couchbase/Protostellar/Management/BucketManager.php @@ -52,7 +52,7 @@ public function __construct(Client $client) /** * @throws InvalidArgumentException */ - public function createBucket(BucketSettings $settings, CreateBucketOptions $options = null) + public function createBucket(BucketSettings $settings, ?CreateBucketOptions $options = null) { $exportedSettings = BucketSettings::export($settings); $exportedOptions = CreateBucketOptions::export($options); @@ -70,7 +70,7 @@ public function createBucket(BucketSettings $settings, CreateBucketOptions $opti /** * @throws InvalidArgumentException */ - public function updateBucket(BucketSettings $settings, UpdateBucketOptions $options = null) + public function updateBucket(BucketSettings $settings, ?UpdateBucketOptions $options = null) { $exportedSettings = BucketSettings::export($settings); $exportedOptions = UpdateBucketOptions::export($options); @@ -85,7 +85,7 @@ public function updateBucket(BucketSettings $settings, UpdateBucketOptions $opti ); } - public function dropBucket(string $name, DropBucketOptions $options = null) + public function dropBucket(string $name, ?DropBucketOptions $options = null) { $exportedOptions = DropBucketOptions::export($options); $request = RequestFactory::makeRequest( @@ -102,7 +102,7 @@ public function dropBucket(string $name, DropBucketOptions $options = null) /** * @throws BucketNotFoundException */ - public function getBucket(string $name, GetBucketOptions $options = null): BucketSettings + public function getBucket(string $name, ?GetBucketOptions $options = null): BucketSettings { $exportedOptions = GetBucketOptions::export($options); $getAllBucketOptions = isset($exportedOptions['timeoutMilliseconds']) @@ -119,7 +119,7 @@ public function getBucket(string $name, GetBucketOptions $options = null): Bucke /** * @throws DecodingFailureException|InvalidArgumentException */ - public function getAllBuckets(GetAllBucketsOptions $options = null): array + public function getAllBuckets(?GetAllBucketsOptions $options = null): array { $exportedOptions = GetAllBucketsOptions::export($options); $timeout = $this->client->timeoutHandler()->getTimeout(TimeoutHandler::MANAGEMENT, $exportedOptions); @@ -141,7 +141,7 @@ public function getAllBuckets(GetAllBucketsOptions $options = null): array /** * @throws UnsupportedOperationException */ - public function flush(string $name, FlushBucketOptions $options = null) + public function flush(string $name, ?FlushBucketOptions $options = null) { throw new UnsupportedOperationException("Flush is not available in CNG"); } diff --git a/Couchbase/Protostellar/Management/CollectionManager.php b/Couchbase/Protostellar/Management/CollectionManager.php index 5a05d326..b7a4d759 100644 --- a/Couchbase/Protostellar/Management/CollectionManager.php +++ b/Couchbase/Protostellar/Management/CollectionManager.php @@ -50,7 +50,7 @@ public function __construct(string $bucketName, Client $client) $this->client = $client; } - public function getAllScopes(GetAllScopesOptions $options = null): array + public function getAllScopes(?GetAllScopesOptions $options = null): array { $exportedOptions = GetAllScopesOptions::export($options); $request = RequestFactory::makeRequest( @@ -65,7 +65,7 @@ public function getAllScopes(GetAllScopesOptions $options = null): array return CollectionManagementResponseConverter::convertGetAllScopesResult($res); } - public function createScope(string $name, CreateScopeOptions $options = null) + public function createScope(string $name, ?CreateScopeOptions $options = null) { $exportedOptions = CreateScopeOptions::export($options); $request = RequestFactory::makeRequest( @@ -79,7 +79,7 @@ public function createScope(string $name, CreateScopeOptions $options = null) ); } - public function dropScope(string $name, DropScopeOptions $options = null) + public function dropScope(string $name, ?DropScopeOptions $options = null) { $exportedOptions = DropScopeOptions::export($options); $request = RequestFactory::makeRequest( @@ -151,7 +151,7 @@ public function dropCollection($scopeName, $collectionName = null, $options = nu /** * @throws UnsupportedOperationException */ - public function updateCollection(string $scopeName, string $collectionName, UpdateCollectionSettings $settings, UpdateCollectionOptions $options = null) + public function updateCollection(string $scopeName, string $collectionName, UpdateCollectionSettings $settings, ?UpdateCollectionOptions $options = null) { throw new UnsupportedOperationException("Update collection is not yet supported in CNG"); } diff --git a/Couchbase/Protostellar/Management/CollectionQueryIndexManager.php b/Couchbase/Protostellar/Management/CollectionQueryIndexManager.php index 829fe492..36a82465 100644 --- a/Couchbase/Protostellar/Management/CollectionQueryIndexManager.php +++ b/Couchbase/Protostellar/Management/CollectionQueryIndexManager.php @@ -57,7 +57,7 @@ public function __construct(string $collectionName, string $scopeName, string $b * @throws DecodingFailureException * @throws InvalidArgumentException */ - public function getAllIndexes(GetAllQueryIndexesOptions $options = null): array + public function getAllIndexes(?GetAllQueryIndexesOptions $options = null): array { $exportedOptions = GetAllQueryIndexesOptions::export($options); $this->checkOptions($exportedOptions); @@ -76,7 +76,7 @@ public function getAllIndexes(GetAllQueryIndexesOptions $options = null): array /** * @throws InvalidArgumentException */ - public function createPrimaryIndex(CreateQueryPrimaryIndexOptions $options = null) + public function createPrimaryIndex(?CreateQueryPrimaryIndexOptions $options = null) { $exportedOptions = CreateQueryPrimaryIndexOptions::export($options); $this->checkOptions($exportedOptions); @@ -94,7 +94,7 @@ public function createPrimaryIndex(CreateQueryPrimaryIndexOptions $options = nul /** * @throws InvalidArgumentException */ - public function createIndex(string $indexName, array $fields, CreateQueryIndexOptions $options = null) + public function createIndex(string $indexName, array $fields, ?CreateQueryIndexOptions $options = null) { $exportedOptions = CreateQueryIndexOptions::export($options); $this->checkOptions($exportedOptions); @@ -112,7 +112,7 @@ public function createIndex(string $indexName, array $fields, CreateQueryIndexOp /** * @throws InvalidArgumentException */ - public function dropIndex(string $indexName, DropQueryIndexOptions $options = null) + public function dropIndex(string $indexName, ?DropQueryIndexOptions $options = null) { $exportedOptions = DropQueryIndexOptions::export($options); $this->checkOptions($exportedOptions); @@ -130,7 +130,7 @@ public function dropIndex(string $indexName, DropQueryIndexOptions $options = nu /** * @throws InvalidArgumentException */ - public function dropPrimaryIndex(DropQueryPrimaryIndexOptions $options = null) + public function dropPrimaryIndex(?DropQueryPrimaryIndexOptions $options = null) { $exportedOptions = DropQueryPrimaryIndexOptions::export($options); $this->checkOptions($exportedOptions); @@ -148,7 +148,7 @@ public function dropPrimaryIndex(DropQueryPrimaryIndexOptions $options = null) /** * @throws InvalidArgumentException */ - public function buildDeferredIndexes(BuildQueryIndexesOptions $options = null) + public function buildDeferredIndexes(?BuildQueryIndexesOptions $options = null) { $exportedOptions = BuildQueryIndexesOptions::export($options); $this->checkOptions($exportedOptions); @@ -167,7 +167,7 @@ public function buildDeferredIndexes(BuildQueryIndexesOptions $options = null) * @throws UnambiguousTimeoutException * @throws InvalidArgumentException */ - public function watchIndexes(array $indexNames, int $timeoutMilliseconds, WatchQueryIndexesOptions $options = null) + public function watchIndexes(array $indexNames, int $timeoutMilliseconds, ?WatchQueryIndexesOptions $options = null) { $exported = WatchQueryIndexesOptions::export($options); $this->checkOptions($exported); diff --git a/Couchbase/Protostellar/Management/QueryIndexManager.php b/Couchbase/Protostellar/Management/QueryIndexManager.php index 6e8f0a6c..45670f80 100644 --- a/Couchbase/Protostellar/Management/QueryIndexManager.php +++ b/Couchbase/Protostellar/Management/QueryIndexManager.php @@ -50,7 +50,7 @@ public function __construct(Client $client) /** * @throws DecodingFailureException */ - public function getAllIndexes(string $bucketName, GetAllQueryIndexesOptions $options = null): array + public function getAllIndexes(string $bucketName, ?GetAllQueryIndexesOptions $options = null): array { $exportedOptions = GetAllQueryIndexesOptions::export($options); $request = RequestFactory::makeRequest( @@ -65,7 +65,7 @@ public function getAllIndexes(string $bucketName, GetAllQueryIndexesOptions $opt return QueryIndexManagementResponseConverter::convertGetAllIndexesResult($response); } - public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOptions $options = null) + public function createPrimaryIndex(string $bucketName, ?CreateQueryPrimaryIndexOptions $options = null) { $exportedOptions = CreateQueryPrimaryIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -79,7 +79,7 @@ public function createPrimaryIndex(string $bucketName, CreateQueryPrimaryIndexOp ); } - public function createIndex(string $bucketName, string $indexName, array $fields, CreateQueryIndexOptions $options = null) + public function createIndex(string $bucketName, string $indexName, array $fields, ?CreateQueryIndexOptions $options = null) { $exportedOptions = CreateQueryIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -93,7 +93,7 @@ public function createIndex(string $bucketName, string $indexName, array $fields ); } - public function dropIndex(string $bucketName, string $indexName, DropQueryIndexOptions $options = null) + public function dropIndex(string $bucketName, string $indexName, ?DropQueryIndexOptions $options = null) { $exportedOptions = DropQueryIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -107,7 +107,7 @@ public function dropIndex(string $bucketName, string $indexName, DropQueryIndexO ); } - public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOptions $options = null) + public function dropPrimaryIndex(string $bucketName, ?DropQueryPrimaryIndexOptions $options = null) { $exportedOptions = DropQueryPrimaryIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -121,7 +121,7 @@ public function dropPrimaryIndex(string $bucketName, DropQueryPrimaryIndexOption ); } - public function buildDeferredIndexes(string $bucketName, BuildQueryIndexesOptions $options = null) + public function buildDeferredIndexes(string $bucketName, ?BuildQueryIndexesOptions $options = null) { $exportedOptions = BuildQueryIndexesOptions::export($options); $request = RequestFactory::makeRequest( @@ -139,7 +139,7 @@ public function buildDeferredIndexes(string $bucketName, BuildQueryIndexesOption * @throws UnambiguousTimeoutException * @throws DecodingFailureException */ - public function watchIndexes(string $bucketName, array $indexNames, int $timeoutMilliseconds, WatchQueryIndexesOptions $options = null) + public function watchIndexes(string $bucketName, array $indexNames, int $timeoutMilliseconds, ?WatchQueryIndexesOptions $options = null) { $exported = WatchQueryIndexesOptions::export($options); if (array_key_exists("watchPrimary", $exported) && $exported["watchPrimary"]) { diff --git a/Couchbase/Protostellar/Management/SearchIndexManager.php b/Couchbase/Protostellar/Management/SearchIndexManager.php index 7d6edae7..b41c9312 100644 --- a/Couchbase/Protostellar/Management/SearchIndexManager.php +++ b/Couchbase/Protostellar/Management/SearchIndexManager.php @@ -53,7 +53,7 @@ public function __construct(Client $client) /** * @throws InvalidArgumentException */ - public function getIndex(string $indexName, GetSearchIndexOptions $options = null): SearchIndex + public function getIndex(string $indexName, ?GetSearchIndexOptions $options = null): SearchIndex { $exportedOptions = GetSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -71,7 +71,7 @@ public function getIndex(string $indexName, GetSearchIndexOptions $options = nul /** * @throws InvalidArgumentException */ - public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array + public function getAllIndexes(?GetAllSearchIndexesOptions $options = null): array { $exportedOptions = GetAllSearchIndexesOptions::export($options); $request = RequestFactory::makeRequest( @@ -86,7 +86,7 @@ public function getAllIndexes(GetAllSearchIndexesOptions $options = null): array return SearchIndexManagementResponseConverter::convertGetAllIndexesResult($response); } - public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptions $options = null) + public function upsertIndex(SearchIndex $indexDefinition, ?UpsertSearchIndexOptions $options = null) { $exportedOptions = UpsertSearchIndexOptions::export($options); $exportedIndex = SearchIndex::export($indexDefinition); @@ -113,7 +113,7 @@ public function upsertIndex(SearchIndex $indexDefinition, UpsertSearchIndexOptio } } - public function dropIndex(string $name, DropSearchIndexOptions $options = null) + public function dropIndex(string $name, ?DropSearchIndexOptions $options = null) { $exportedOptions = DropSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -127,7 +127,7 @@ public function dropIndex(string $name, DropSearchIndexOptions $options = null) ); } - public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchIndexOptions $options = null): int + public function getIndexedDocumentsCount(string $indexName, ?GetIndexedSearchIndexOptions $options = null): int { $exportedOptions = GetIndexedSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -141,7 +141,7 @@ public function getIndexedDocumentsCount(string $indexName, GetIndexedSearchInde ); } - public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $options = null) + public function pauseIngest(string $indexName, ?PauseIngestSearchIndexOptions $options = null) { $exportedOptions = PauseIngestSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -155,7 +155,7 @@ public function pauseIngest(string $indexName, PauseIngestSearchIndexOptions $op ); } - public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $options = null) + public function resumeIngest(string $indexName, ?ResumeIngestSearchIndexOptions $options = null) { $exportedOptions = ResumeIngestSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -169,7 +169,7 @@ public function resumeIngest(string $indexName, ResumeIngestSearchIndexOptions $ ); } - public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions $options = null) + public function allowQuerying(string $indexName, ?AllowQueryingSearchIndexOptions $options = null) { $exportedOptions = AllowQueryingSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -183,7 +183,7 @@ public function allowQuerying(string $indexName, AllowQueryingSearchIndexOptions ); } - public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexOptions $options = null) + public function disallowQuerying(string $indexName, ?DisallowQueryingSearchIndexOptions $options = null) { $exportedOptions = DisallowQueryingSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -197,7 +197,7 @@ public function disallowQuerying(string $indexName, DisallowQueryingSearchIndexO ); } - public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $options = null) + public function freezePlan(string $indexName, ?FreezePlanSearchIndexOptions $options = null) { $exportedOptions = FreezePlanSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -211,7 +211,7 @@ public function freezePlan(string $indexName, FreezePlanSearchIndexOptions $opti ); } - public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $options = null) + public function unfreezePlan(string $indexName, ?UnfreezePlanSearchIndexOptions $options = null) { $exportedOptions = UnfreezePlanSearchIndexOptions::export($options); $request = RequestFactory::makeRequest( @@ -225,7 +225,7 @@ public function unfreezePlan(string $indexName, UnfreezePlanSearchIndexOptions $ ); } - public function analyzeDocument(string $indexName, $document, AnalyzeDocumentOptions $options = null): array + public function analyzeDocument(string $indexName, $document, ?AnalyzeDocumentOptions $options = null): array { $exportedOptions = AnalyzeDocumentOptions::export($options); $request = RequestFactory::makeRequest( diff --git a/Couchbase/Protostellar/ProtocolException.php b/Couchbase/Protostellar/ProtocolException.php index 95fe8117..d91623d4 100644 --- a/Couchbase/Protostellar/ProtocolException.php +++ b/Couchbase/Protostellar/ProtocolException.php @@ -45,7 +45,7 @@ class ProtocolException extends Exception { private ?object $grpcStatus = null; - public function __construct($message, $grpcStatus = null, Throwable $previous = null) + public function __construct($message, $grpcStatus = null, ?Throwable $previous = null) { $code = 0; if ($grpcStatus) { diff --git a/Couchbase/Protostellar/Retries/BestEffortRetryStrategy.php b/Couchbase/Protostellar/Retries/BestEffortRetryStrategy.php index 8c457735..dd5adda1 100644 --- a/Couchbase/Protostellar/Retries/BestEffortRetryStrategy.php +++ b/Couchbase/Protostellar/Retries/BestEffortRetryStrategy.php @@ -26,7 +26,7 @@ class BestEffortRetryStrategy implements RetryStrategy { private BackoffCalculator $calculator; - public function __construct(BackoffCalculator $calculator = null) + public function __construct(?BackoffCalculator $calculator = null) { if (is_null($calculator)) { $this->calculator = new ExponentialBackoff(); diff --git a/Couchbase/Protostellar/Scope.php b/Couchbase/Protostellar/Scope.php index 944ead20..e208822b 100644 --- a/Couchbase/Protostellar/Scope.php +++ b/Couchbase/Protostellar/Scope.php @@ -62,7 +62,7 @@ public function collection(string $name): Collection /** * @throws InvalidArgumentException */ - public function query(string $statement, QueryOptions $options = null): QueryResult + public function query(string $statement, ?QueryOptions $options = null): QueryResult { $exportedOptions = QueryOptions::export($options); $exportedOptions["bucketName"] = $this->bucketName; @@ -80,7 +80,7 @@ public function query(string $statement, QueryOptions $options = null): QueryRes return new QueryResult($finalArray, QueryOptions::getTranscoder($options)); } - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { $exportedOptions = AnalyticsOptions::export($options, $this->name, $this->bucketName); $request = RequestFactory::makeRequest( diff --git a/Couchbase/QueryOptions.php b/Couchbase/QueryOptions.php index 0daaac47..1e51a5cc 100644 --- a/Couchbase/QueryOptions.php +++ b/Couchbase/QueryOptions.php @@ -414,7 +414,7 @@ public static function getTranscoder(?QueryOptions $options): Transcoder return $options->transcoder; } - public static function export(?QueryOptions $options, string $scopeName = null, string $bucketName = null): array + public static function export(?QueryOptions $options, ?string $scopeName = null, ?string $bucketName = null): array { $defaultQueryContext = null; if ($scopeName != null && $bucketName != null) { diff --git a/Couchbase/RangeScan.php b/Couchbase/RangeScan.php index 6d3303e6..2e035a05 100644 --- a/Couchbase/RangeScan.php +++ b/Couchbase/RangeScan.php @@ -34,7 +34,7 @@ class RangeScan implements ScanType * * @since 4.1.6 */ - public function __construct(ScanTerm $from = null, ScanTerm $to = null) + public function __construct(?ScanTerm $from = null, ?ScanTerm $to = null) { $this->from = $from; $this->to = $to; @@ -49,7 +49,7 @@ public function __construct(ScanTerm $from = null, ScanTerm $to = null) * @return RangeScan * @since 4.1.6 */ - public static function build(ScanTerm $from = null, ScanTerm $to = null): RangeScan + public static function build(?ScanTerm $from = null, ?ScanTerm $to = null): RangeScan { return new RangeScan($from, $to); } diff --git a/Couchbase/RequestTracer.php b/Couchbase/RequestTracer.php index 6a8e89db..440c1041 100644 --- a/Couchbase/RequestTracer.php +++ b/Couchbase/RequestTracer.php @@ -31,5 +31,5 @@ interface RequestTracer * @param string $name The name of the span. * @param string|null $parent The parent of the span, if one exists. */ - public function requestSpan(string $name, RequestSpan $parent = null); + public function requestSpan(string $name, ?RequestSpan $parent = null); } diff --git a/Couchbase/SamplingScan.php b/Couchbase/SamplingScan.php index e1e4a8e8..ac0942f8 100644 --- a/Couchbase/SamplingScan.php +++ b/Couchbase/SamplingScan.php @@ -37,7 +37,7 @@ class SamplingScan implements ScanType * @throws InvalidArgumentException * @since 4.1.6 */ - public function __construct(int $limit, int $seed = null) + public function __construct(int $limit, ?int $seed = null) { if ($limit < 1) { throw new InvalidArgumentException("The limit must be positive"); @@ -56,7 +56,7 @@ public function __construct(int $limit, int $seed = null) * @throws InvalidArgumentException * @since 4.1.6 */ - public static function build(int $limit, int $seed = null): SamplingScan + public static function build(int $limit, ?int $seed = null): SamplingScan { return new SamplingScan($limit, $seed); } diff --git a/Couchbase/ScanTerm.php b/Couchbase/ScanTerm.php index f9261ad4..0aa5b680 100644 --- a/Couchbase/ScanTerm.php +++ b/Couchbase/ScanTerm.php @@ -31,7 +31,7 @@ class ScanTerm * * @since 4.1.6 */ - public function __construct(string $term, bool $exclusive = null) + public function __construct(string $term, ?bool $exclusive = null) { $this->term = $term; $this->exclusive = $exclusive; @@ -46,7 +46,7 @@ public function __construct(string $term, bool $exclusive = null) * @return ScanTerm * @since 4.1.6 */ - public static function build(string $term, bool $exclusive = null): ScanTerm + public static function build(string $term, ?bool $exclusive = null): ScanTerm { return new ScanTerm($term, $exclusive); } diff --git a/Couchbase/Scope.php b/Couchbase/Scope.php index b0e699b7..a8a4de0f 100644 --- a/Couchbase/Scope.php +++ b/Couchbase/Scope.php @@ -89,7 +89,7 @@ public function collection(string $name): CollectionInterface * @throws CouchbaseException * @since 4.0.0 */ - public function query(string $statement, QueryOptions $options = null): QueryResult + public function query(string $statement, ?QueryOptions $options = null): QueryResult { $result = Extension\query($this->core, $statement, QueryOptions::export($options, $this->name, $this->bucketName)); @@ -107,7 +107,7 @@ public function query(string $statement, QueryOptions $options = null): QueryRes * @throws CouchbaseException * @since 4.0.0 */ - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult { $result = Extension\analyticsQuery($this->core, $statement, AnalyticsOptions::export($options, $this->name, $this->bucketName)); @@ -127,7 +127,7 @@ public function analyticsQuery(string $statement, AnalyticsOptions $options = nu * @throws InvalidArgumentException * @since 4.1.7 */ - public function search(string $indexName, SearchRequest $request, SearchOptions $options = null): SearchResult + public function search(string $indexName, SearchRequest $request, ?SearchOptions $options = null): SearchResult { $exportedRequest = SearchRequest::export($request); $exportedOptions = SearchOptions::export($options); diff --git a/Couchbase/ScopeInterface.php b/Couchbase/ScopeInterface.php index fbbce9e3..0491a4c9 100644 --- a/Couchbase/ScopeInterface.php +++ b/Couchbase/ScopeInterface.php @@ -31,11 +31,11 @@ public function name(): string; public function collection(string $name): CollectionInterface; - public function query(string $statement, QueryOptions $options = null): QueryResult; + public function query(string $statement, ?QueryOptions $options = null): QueryResult; - public function search(string $indexName, SearchRequest $request, SearchOptions $options = null): SearchResult; + public function search(string $indexName, SearchRequest $request, ?SearchOptions $options = null): SearchResult; - public function analyticsQuery(string $statement, AnalyticsOptions $options = null): AnalyticsResult; + public function analyticsQuery(string $statement, ?AnalyticsOptions $options = null): AnalyticsResult; public function searchIndexes(): ScopeSearchIndexManagerInterface; } diff --git a/Couchbase/SearchOptions.php b/Couchbase/SearchOptions.php index 80e09812..2d5351e2 100644 --- a/Couchbase/SearchOptions.php +++ b/Couchbase/SearchOptions.php @@ -220,7 +220,7 @@ public function sort(array $specs): SearchOptions * @see \SearchHighlightMode::ANSI * @see \SearchHighlightMode::SIMPLE */ - public function highlight(string $style = null, array $fields = null): SearchOptions + public function highlight(?string $style = null, ?array $fields = null): SearchOptions { $this->highlight['style'] = $style; $this->highlight['fields'] = $fields; diff --git a/Couchbase/ThresholdLoggingTracer.php b/Couchbase/ThresholdLoggingTracer.php index 643b2d5f..51f700bb 100644 --- a/Couchbase/ThresholdLoggingTracer.php +++ b/Couchbase/ThresholdLoggingTracer.php @@ -34,7 +34,7 @@ class ThresholdLoggingTracer implements RequestTracer /** * @throws UnsupportedOperationException */ - public function requestSpan(string $name, RequestSpan $parent = null) + public function requestSpan(string $name, ?RequestSpan $parent = null) { throw new UnsupportedOperationException(); } diff --git a/Couchbase/TransactionQueryOptions.php b/Couchbase/TransactionQueryOptions.php index ab1b7b44..7e47c30c 100644 --- a/Couchbase/TransactionQueryOptions.php +++ b/Couchbase/TransactionQueryOptions.php @@ -362,7 +362,7 @@ public static function getTranscoder(?TransactionQueryOptions $options): Transco return $options->transcoder; } - public static function export(?TransactionQueryOptions $options, string $scopeName = null, string $bucketName = null): array + public static function export(?TransactionQueryOptions $options, ?string $scopeName = null, ?string $bucketName = null): array { if ($options == null) { return [ diff --git a/Couchbase/VectorSearch.php b/Couchbase/VectorSearch.php index d82efa5f..fd952209 100644 --- a/Couchbase/VectorSearch.php +++ b/Couchbase/VectorSearch.php @@ -38,7 +38,7 @@ class VectorSearch implements JsonSerializable * * @UNCOMMITTED: This API may change in the future. */ - public function __construct(array $vectorQueries, VectorSearchOptions $options = null) + public function __construct(array $vectorQueries, ?VectorSearchOptions $options = null) { if (empty($vectorQueries)) { throw new InvalidArgumentException("At least one vector query must be specified"); @@ -58,7 +58,7 @@ public function __construct(array $vectorQueries, VectorSearchOptions $options = * * @UNCOMMITTED: This API may change in the future. */ - public static function build(array $vectorQueries, VectorSearchOptions $options = null): VectorSearch + public static function build(array $vectorQueries, ?VectorSearchOptions $options = null): VectorSearch { return new VectorSearch($vectorQueries, $options); } diff --git a/tests/CollectionManagerTest.php b/tests/CollectionManagerTest.php index a4007e29..d3d2be3a 100644 --- a/tests/CollectionManagerTest.php +++ b/tests/CollectionManagerTest.php @@ -409,7 +409,7 @@ public function testCreateCollectionZeroExpiry(): void /** * @throws ScopeNotFoundException */ - private function getScope(string $scopeName, CollectionManager $manager = null): ScopeSpec + private function getScope(string $scopeName, ?CollectionManager $manager = null): ScopeSpec { if (is_null($manager)) { $manager = $this->manager;