-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add union type to support the ClientOptions class in the client constructor #725
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick review!
@@ -72,6 +72,7 @@ private function generateImpl(): PhpFile | |||
{ | |||
// TODO(vNext): Remove the forced addition of these `use` clauses. | |||
$this->ctx->type(Type::fromName(\Google\ApiCore\PathTemplate::class)); | |||
$this->ctx->type(Type::fromName(\Google\ApiCore\Options\ClientOptions::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably go in private function construct()
, to keep it together with the function it goes with below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see what you mean, my thought was to match 1 to 1 how does this gets placed in the generated file. For example, due finding Google\ApiCore\PathTemplate
on the generated file, I was able to determine how this gets added.
Still, I am not completely opposed to moving it to another place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When these changes roll out, we'll need to pin to whatever minimum version of GAX supports the new method signatures in GapicClientTrait::buildLCientOptions
(in google-cloud-php
)
@@ -333,7 +334,7 @@ public static function parseName(string $formattedName, string $template = null) | |||
* | |||
* @throws ValidationException | |||
*/ | |||
public function __construct(array $options = []) | |||
public function __construct(array|ClientOptions $options = []) | |||
{ | |||
$clientOptions = $this->buildClientOptions($options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As buildClientOptions
doesn't support ClientOptions
, we'll need to update this in GAX (this is somewhat handled in googleapis/gax-php#580, but should probably be separated from the changes to make the properties public).
No description provided.