diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..987e2a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +composer.lock +vendor diff --git a/composer.json b/composer.json index 755ea4b..28e457d 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,10 @@ "keywords": ["rpc"], "homepage": "https://grpc.io", "license": "Apache-2.0", - "version": "1.57.0", + "version": "1.74.0", "require": { - "php": ">=7.0.0" + "php": ">=7.1.0", + "google/protobuf": "^v3.3.0" }, "require-dev": { "google/auth": "^v1.3.0" diff --git a/src/lib/ServerCallWriter.php b/src/lib/ServerCallWriter.php index aceb20c..40fbe99 100644 --- a/src/lib/ServerCallWriter.php +++ b/src/lib/ServerCallWriter.php @@ -81,7 +81,7 @@ public function finish( private function addSendInitialMetadataOpIfNotSent( array &$batch, - array $initialMetadata = null + ?array $initialMetadata = null ) { if (!$this->initialMetadataSent_) { $batch[OP_SEND_INITIAL_METADATA] = $initialMetadata ?? []; diff --git a/src/lib/Status.php b/src/lib/Status.php index add208f..d47480f 100644 --- a/src/lib/Status.php +++ b/src/lib/Status.php @@ -32,7 +32,7 @@ */ class Status { - public static function status(int $code, string $details, array $metadata = null): array + public static function status(int $code, string $details, ?array $metadata = null): array { $status = [ 'code' => $code, @@ -44,7 +44,7 @@ public static function status(int $code, string $details, array $metadata = null return $status; } - public static function ok(array $metadata = null): array + public static function ok(?array $metadata = null): array { return Status::status(STATUS_OK, 'OK', $metadata); } diff --git a/src/lib/UnaryCall.php b/src/lib/UnaryCall.php index e849649..76d96cc 100644 --- a/src/lib/UnaryCall.php +++ b/src/lib/UnaryCall.php @@ -22,6 +22,8 @@ /** * Represents an active call that sends a single message and then gets a * single response. + * + * @template T of \Google\Protobuf\Internal\Message */ class UnaryCall extends AbstractCall { @@ -50,7 +52,7 @@ public function start($data, array $metadata = [], array $options = []) /** * Wait for the server to respond with data and a status. * - * @return array [response data, status] + * @return array{0: T|null, 1: \stdClass} [response data, status] */ public function wait() {