mirror of https://github.com/grpc/grpc.git
[PHP] Add @deprecated tag in PHP generated methods and services (#32652)
When we deprecate services in proto-file: ```proto syntax = "proto3"; option php_namespace = "Test"; service MyService { option deprecated = true; rpc Call(Test) returns (Test) { option deprecated = true; }; } message Test { } ``` It might be a good idea to propagate this flat in the generated classes so that the final users will be aware of the changes coming soon. Example of the generated code: ```php <?php // GENERATED CODE -- DO NOT EDIT! namespace Test; /** * @deprecated */ class MyServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname * @param array $opts channel options * @param \Grpc\Channel $channel (optional) re-use channel object */ public function __construct($hostname, $opts, $channel = null) { parent::__construct($hostname, $opts, $channel); } /** * @deprecated * @param \Test\Test $argument input argument * @param array $metadata metadata * @param array $options call options * @return \Grpc\UnaryCall */ public function Call(\Test\Test $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/MyService/Call', $argument, ['\Test\Test', 'decode'], $metadata, $options); } } ``` These tags will cause IDE to highlight the class/method to bring the developer's attention. This is consistent with how "protoc" handles the "deprecated" option for PHP <!-- If you know who should review your pull request, please assign it to that person, otherwise the pull request would get assigned randomly. If your pull request is for a specific language, please add the appropriate lang label. -->pull/33150/head^2
parent
b35ea15265
commit
41b66b4859
1 changed files with 13 additions and 1 deletions
Loading…
Reference in new issue