Skip to content

Commit 4a42a1f

Browse files
authored
Change client stream server api (#6)
1 parent 77a827b commit 4a42a1f

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,11 @@ interface QueueServiceServer
429429
/**
430430
* @param Server\ClientStreamChannel<\Thesis\Api\V1\Message, \Google\Protobuf\Empty_> $stream
431431
*/
432-
public function push(Server\ClientStreamChannel $stream, Metadata $md, Cancellation $cancellation): void;
432+
public function push(
433+
Server\ClientStreamChannel $stream,
434+
Metadata $md,
435+
Cancellation $cancellation,
436+
): \Google\Protobuf\Empty_;
433437

434438
/**
435439
* @param Server\ServerStreamChannel<\Google\Protobuf\Empty_, \Thesis\Api\V1\Message> $stream

src/Plugin/Generator/GrpcGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function generateServer(Parser\ServiceDescriptor $service): PhpNamespace
248248
new Parameter('md')->setType('Metadata'),
249249
new Parameter('cancellation')->setType('Cancellation'),
250250
])
251-
->setReturnType('void')
251+
->setReturnType($out->fqcn)
252252
->addComment("{$phpdocPrefix}@param Server\\ClientStreamChannel<{$in->fqcn}, {$out->fqcn}> \$stream");
253253
} elseif (!$method->clientStreaming && $method->serverStreaming) {
254254
$interfaceMethod

tests/CompilerTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,11 @@ interface QueueServiceServer
17061706
/**
17071707
* @param Server\ClientStreamChannel<\Thesis\Queue\PushRequest\Message, \Google\Protobuf\Empty_> $stream
17081708
*/
1709-
public function push(Server\ClientStreamChannel $stream, Metadata $md, Cancellation $cancellation): void;
1709+
public function push(
1710+
Server\ClientStreamChannel $stream,
1711+
Metadata $md,
1712+
Cancellation $cancellation,
1713+
): \Google\Protobuf\Empty_;
17101714
17111715
/**
17121716
* @param Server\ServerStreamChannel<\Thesis\Queue\PullRequest, \Thesis\Queue\PullRequest\Message> $stream

0 commit comments

Comments
 (0)