Tobias Grether
unread,Jun 29, 2023, 9:09:07 AM6/29/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to grpc.io
GRPC is a very useful tool that helps everyone get typesafe APIs set up quickly.
However, a lot of that type safety is sadly lost in the PHP implementation of grpc.
GRPC knows how the response will be structured, however instead of returning a structured response object which will allow autocomplete and static analysis, grpc opts to return the response data of a UnaryCall in an stdclass, which is a dynamic class which can hold any property dynamically.
The issue with this is that it makes both autocomplete and static analysis with for example PHPStan completely impossible.
Since GRPC already knows how the response is structured, and since PHP has become a lot more type-safe since php5, I think it would be appropriate to update GRPC to reflect that.