From d76250ced97acb0b1b98f2128ec22ae990735f51 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Mar 2026 10:17:27 -0700 Subject: [PATCH 1/3] chore: allow for longrunning v1 --- composer.json | 2 +- src/GapicClientTrait.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 810351fed..9eb581475 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "guzzlehttp/promises": "^2.0", "guzzlehttp/psr7": "^2.0", "google/common-protos": "^4.4", - "google/longrunning": "~0.4", + "google/longrunning": "~0.4||^1.0", "ramsey/uuid": "^4.0" }, "require-dev": { diff --git a/src/GapicClientTrait.php b/src/GapicClientTrait.php index 7a527ee32..6f683bd0a 100644 --- a/src/GapicClientTrait.php +++ b/src/GapicClientTrait.php @@ -32,7 +32,6 @@ namespace Google\ApiCore; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Middleware\CredentialsWrapperMiddleware; use Google\ApiCore\Middleware\FixedHeaderMiddleware; use Google\ApiCore\Middleware\OperationsMiddleware; @@ -50,6 +49,7 @@ use Google\ApiCore\Transport\TransportInterface; use Google\Auth\FetchAuthTokenInterface; use Google\LongRunning\Operation; +use Google\LongRunning\OperationsClient; use Google\Protobuf\Internal\Message; use GuzzleHttp\Promise\PromiseInterface; From 7cd78d3210ed89c3953f7622581a6bbcadf12909 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Mar 2026 10:47:55 -0700 Subject: [PATCH 2/3] chore!: remove deprecated classes and methods --- ...eAddressTrait.php => ApiEndpointTrait.php} | 8 +- src/CredentialsWrapper.php | 18 ---- src/KnownTypes.php | 5 - src/Options/CallOptions.php | 10 -- .../TransportOptions/GrpcTransportOptions.php | 13 +-- .../Grpc/UnaryInterceptorInterface.php | 61 ------------ src/Transport/GrpcFallbackTransport.php | 6 +- src/Transport/GrpcTransport.php | 23 +---- src/Transport/RestTransport.php | 6 +- ...TraitTest.php => ApiEndpointTraitTest.php} | 26 +++-- tests/Unit/CredentialsWrapperTest.php | 99 ------------------- 11 files changed, 27 insertions(+), 248 deletions(-) rename src/{ServiceAddressTrait.php => ApiEndpointTrait.php} (89%) delete mode 100644 src/Transport/Grpc/UnaryInterceptorInterface.php rename tests/Unit/{ServiceAddressTraitTest.php => ApiEndpointTraitTest.php} (62%) diff --git a/src/ServiceAddressTrait.php b/src/ApiEndpointTrait.php similarity index 89% rename from src/ServiceAddressTrait.php rename to src/ApiEndpointTrait.php index 1343a233c..eefc36324 100644 --- a/src/ServiceAddressTrait.php +++ b/src/ApiEndpointTrait.php @@ -34,12 +34,8 @@ /** * Provides helper methods for service address handling. - * - * @deprecated - * @todo (dwsupplee) serviceAddress is deprecated now in favor of - * apiEndpoint. Rename the trait/method in our next major release. */ -trait ServiceAddressTrait +trait ApiEndpointTrait { private static $defaultPort = 443; @@ -48,7 +44,7 @@ trait ServiceAddressTrait * @return array * @throws ValidationException */ - private static function normalizeServiceAddress(string $apiEndpoint) + private static function normalizeApiEndpoint(string $apiEndpoint) { $components = explode(':', $apiEndpoint); if (count($components) == 2) { diff --git a/src/CredentialsWrapper.php b/src/CredentialsWrapper.php index d6e90892b..7c07238bd 100644 --- a/src/CredentialsWrapper.php +++ b/src/CredentialsWrapper.php @@ -214,24 +214,6 @@ public function getProjectId(?callable $httpHandler = null): ?string return null; } - /** - * @deprecated - * @return string Bearer string containing access token. - */ - public function getBearerString() - { - $token = $this->credentialsFetcher->getLastReceivedToken(); - if (self::isExpired($token)) { - $this->checkUniverseDomain(); - - $token = $this->credentialsFetcher->fetchAuthToken($this->authHttpHandler); - if (!self::isValid($token)) { - return ''; - } - } - return empty($token['access_token']) ? '' : 'Bearer ' . $token['access_token']; - } - /** * @param string $audience optional audience for self-signed JWTs. * @return callable Callable function that returns an authorization header. diff --git a/src/KnownTypes.php b/src/KnownTypes.php index 8d55402d4..bce0ad3e6 100644 --- a/src/KnownTypes.php +++ b/src/KnownTypes.php @@ -38,11 +38,6 @@ class KnownTypes { private static bool $initialized = false; - /** @deprecated use BIN_TYPES instead */ - public const GRPC_TYPES = self::BIN_TYPES; - /** @deprecated use TYPE_URLS instead */ - public const JSON_TYPES = self::TYPE_URLS; - public const BIN_TYPES = [ 'google.rpc.retryinfo-bin' => \Google\Rpc\RetryInfo::class, 'google.rpc.debuginfo-bin' => \Google\Rpc\DebugInfo::class, diff --git a/src/Options/CallOptions.php b/src/Options/CallOptions.php index bae69ddd0..d88dd495e 100644 --- a/src/Options/CallOptions.php +++ b/src/Options/CallOptions.php @@ -136,16 +136,6 @@ public function setTransportOptions(array $transportOptions): self return $this; } - /** - * @deprecated use CallOptions::setTransportOptions - */ - public function setTransportSpecificOptions(array $transportSpecificOptions): self - { - $this->setTransportOptions($transportSpecificOptions); - - return $this; - } - /** * @param RetrySettings|array|null $retrySettings * diff --git a/src/Options/TransportOptions/GrpcTransportOptions.php b/src/Options/TransportOptions/GrpcTransportOptions.php index 051b57bbe..c1b622d04 100644 --- a/src/Options/TransportOptions/GrpcTransportOptions.php +++ b/src/Options/TransportOptions/GrpcTransportOptions.php @@ -36,7 +36,6 @@ use Closure; use Google\ApiCore\Options\OptionsInterface; use Google\ApiCore\Options\OptionsTrait; -use Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface; use Grpc\Channel; use Grpc\Interceptor; use Psr\Log\LoggerInterface; @@ -56,7 +55,7 @@ class GrpcTransportOptions implements ArrayAccess, OptionsInterface private null|false|LoggerInterface $logger; /** - * @var Interceptor[]|UnaryInterceptorInterface[] + * @var Interceptor[] */ private array $interceptors; @@ -69,14 +68,8 @@ class GrpcTransportOptions implements ArrayAccess, OptionsInterface * @type array $stubOpts Options used to construct the gRPC stub (see * {@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}). * @type Channel $channel Grpc channel to be used. - * @type Interceptor[]|UnaryInterceptorInterface[] $interceptors *EXPERIMENTAL* + * @type Interceptor[] $interceptors *EXPERIMENTAL* * Interceptors used to intercept RPC invocations before a call starts. - * Please note that implementations of - * {@see \Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface} are - * considered deprecated and support will be removed in a future - * release. To prepare for this, please take the time to convert - * `UnaryInterceptorInterface` implementations over to a class which - * extends {@see Grpc\Interceptor}. * @type callable $clientCertSource A callable which returns the client cert as a string. * @type null|false|LoggerInterface A PSR-3 Logger Interface. * } @@ -125,7 +118,7 @@ public function setChannel(?Channel $channel): self } /** - * @param Interceptor[]|UnaryInterceptorInterface[] $interceptors + * @param Interceptor[] $interceptors * * @return $this */ diff --git a/src/Transport/Grpc/UnaryInterceptorInterface.php b/src/Transport/Grpc/UnaryInterceptorInterface.php deleted file mode 100644 index fa510ea39..000000000 --- a/src/Transport/Grpc/UnaryInterceptorInterface.php +++ /dev/null @@ -1,61 +0,0 @@ - null, 'logger' => null, ]; - list($baseUri, $port) = self::normalizeServiceAddress($apiEndpoint); + list($baseUri, $port) = self::normalizeApiEndpoint($apiEndpoint); $httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync(logger: $config['logger']); $transport = new GrpcFallbackTransport("$baseUri:$port", $httpHandler); if ($config['clientCertSource']) { diff --git a/src/Transport/GrpcTransport.php b/src/Transport/GrpcTransport.php index 5fd03a6fe..c72df1317 100644 --- a/src/Transport/GrpcTransport.php +++ b/src/Transport/GrpcTransport.php @@ -33,15 +33,14 @@ namespace Google\ApiCore\Transport; use Exception; +use Google\ApiCore\ApiEndpointTrait; use Google\ApiCore\ApiException; use Google\ApiCore\BidiStream; use Google\ApiCore\Call; use Google\ApiCore\ClientStream; use Google\ApiCore\GrpcSupportTrait; use Google\ApiCore\ServerStream; -use Google\ApiCore\ServiceAddressTrait; use Google\ApiCore\Transport\Grpc\ServerStreamingCallWrapper; -use Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface; use Google\ApiCore\ValidationException; use Google\ApiCore\ValidationTrait; use Google\Auth\Logging\LoggingTrait; @@ -59,9 +58,9 @@ */ class GrpcTransport extends BaseStub implements TransportInterface { + use ApiEndpointTrait; use ValidationTrait; use GrpcSupportTrait; - use ServiceAddressTrait; use LoggingTrait; private null|LoggerInterface $logger; @@ -73,14 +72,8 @@ class GrpcTransport extends BaseStub implements TransportInterface * metadata array, and returns an updated metadata array * - 'grpc.primary_user_agent': (optional) a user-agent string * @param Channel $channel An already created Channel object (optional) - * @param Interceptor[]|UnaryInterceptorInterface[] $interceptors *EXPERIMENTAL* + * @param Interceptor[] $interceptors *EXPERIMENTAL* * Interceptors used to intercept RPC invocations before a call starts. - * Please note that implementations of - * {@see \Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface} are - * considered deprecated and support will be removed in a future - * release. To prepare for this, please take the time to convert - * `UnaryInterceptorInterface` implementations over to a class which - * extends {@see Grpc\Interceptor}. * @param null|false|LoggerInterface $logger A PSR-3 Compliant logger. * @throws Exception */ @@ -114,14 +107,8 @@ public function __construct( * @type array $stubOpts Options used to construct the gRPC stub (see * {@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}). * @type Channel $channel Grpc channel to be used. - * @type Interceptor[]|UnaryInterceptorInterface[] $interceptors *EXPERIMENTAL* + * @type Interceptor[] $interceptors *EXPERIMENTAL* * Interceptors used to intercept RPC invocations before a call starts. - * Please note that implementations of - * {@see \Google\ApiCore\Transport\Grpc\UnaryInterceptorInterface} are - * considered deprecated and support will be removed in a future - * release. To prepare for this, please take the time to convert - * `UnaryInterceptorInterface` implementations over to a class which - * extends {@see Grpc\Interceptor}. * @type callable $clientCertSource A callable which returns the client cert as a string. * } * @return GrpcTransport @@ -137,7 +124,7 @@ public static function build(string $apiEndpoint, array $config = []) 'clientCertSource' => null, 'logger' => null, ]; - list($addr, $port) = self::normalizeServiceAddress($apiEndpoint); + list($addr, $port) = self::normalizeApiEndpoint($apiEndpoint); $host = "$addr:$port"; $stubOpts = $config['stubOpts']; // Set the required 'credentials' key in stubOpts if it is not already set. Use diff --git a/src/Transport/RestTransport.php b/src/Transport/RestTransport.php index 296937fa4..d380c4392 100644 --- a/src/Transport/RestTransport.php +++ b/src/Transport/RestTransport.php @@ -31,12 +31,12 @@ */ namespace Google\ApiCore\Transport; +use Google\ApiCore\ApiEndpointTrait; use Google\ApiCore\ApiException; use Google\ApiCore\Call; use Google\ApiCore\InsecureRequestBuilder; use Google\ApiCore\RequestBuilder; use Google\ApiCore\ServerStream; -use Google\ApiCore\ServiceAddressTrait; use Google\ApiCore\Transport\Rest\RestServerStreamingCall; use Google\ApiCore\ValidationException; use Google\ApiCore\ValidationTrait; @@ -50,8 +50,8 @@ */ class RestTransport implements TransportInterface { + use ApiEndpointTrait; use ValidationTrait; - use ServiceAddressTrait; use HttpUnaryTransportTrait { startServerStreamingCall as protected unsupportedServerStreamingCall; } @@ -97,7 +97,7 @@ public static function build(string $apiEndpoint, string $restConfigPath, array 'hasEmulator' => false, 'logger' => null, ]; - list($baseUri, $port) = self::normalizeServiceAddress($apiEndpoint); + list($baseUri, $port) = self::normalizeApiEndpoint($apiEndpoint); $requestBuilder = $config['hasEmulator'] ? new InsecureRequestBuilder("$baseUri:$port", $restConfigPath) : new RequestBuilder("$baseUri:$port", $restConfigPath); diff --git a/tests/Unit/ServiceAddressTraitTest.php b/tests/Unit/ApiEndpointTraitTest.php similarity index 62% rename from tests/Unit/ServiceAddressTraitTest.php rename to tests/Unit/ApiEndpointTraitTest.php index ba5cf81c7..046909d61 100644 --- a/tests/Unit/ServiceAddressTraitTest.php +++ b/tests/Unit/ApiEndpointTraitTest.php @@ -17,29 +17,25 @@ namespace Google\ApiCore\Tests\Unit; -use Google\ApiCore\ServiceAddressTrait; +use Google\ApiCore\ApiEndpointTrait; use Google\ApiCore\ValidationException; use PHPUnit\Framework\TestCase; -/** - * @todo (dwsupplee) serviceAddress is deprecated now in favor of - * apiEndpoint. Rename the tests/variables in our next major release. - */ -class ServiceAddressTraitTest extends TestCase +class ApiEndpointTraitTest extends TestCase { - use ServiceAddressTrait; + use ApiEndpointTrait; /** - * @dataProvider normalizeServiceAddressData + * @dataProvider normalizeApiEndpointData */ - public function testNormalizeServiceAddress($serviceAddressString, $expectedAddress, $expectedPort) + public function testNormalizeApiEndpoint($ApiEndpointString, $expectedAddress, $expectedPort) { - list($actualAddress, $actualPort) = self::normalizeServiceAddress($serviceAddressString); + list($actualAddress, $actualPort) = self::normalizeApiEndpoint($ApiEndpointString); $this->assertSame($expectedAddress, $actualAddress); $this->assertSame($expectedPort, $actualPort); } - public function normalizeServiceAddressData() + public function normalizeApiEndpointData() { return [ ['simple.com:123', 'simple.com', '123'], @@ -49,17 +45,17 @@ public function normalizeServiceAddressData() } /** - * @dataProvider normalizeServiceAddressInvalidData + * @dataProvider normalizeApiEndpointInvalidData */ - public function testNormalizeServiceAddressInvalid($serviceAddressString) + public function testNormalizeApiEndpointInvalid($ApiEndpointString) { $this->expectException(ValidationException::class); $this->expectExceptionMessage('Invalid apiEndpoint'); - self::normalizeServiceAddress($serviceAddressString); + self::normalizeApiEndpoint($ApiEndpointString); } - public function normalizeServiceAddressInvalidData() + public function normalizeApiEndpointInvalidData() { return [ ['too.many:colons:123'], diff --git a/tests/Unit/CredentialsWrapperTest.php b/tests/Unit/CredentialsWrapperTest.php index ca58ceadf..3b6b28b40 100644 --- a/tests/Unit/CredentialsWrapperTest.php +++ b/tests/Unit/CredentialsWrapperTest.php @@ -218,39 +218,6 @@ public function testCheckUniverseDomainFails(?string $universeDomain, ?string $c $credentialsWrapper->getAuthorizationHeaderCallback()(); } - /** - * Same test as above, but calls the deprecated CredentialsWrapper::getBearerString method - * instead of CredentialsWrapper::getAuthorizationHeaderCallback - * @dataProvider provideCheckUniverseDomainFails - */ - public function testCheckUniverseDomainOnGetBearerStringFails( - ?string $universeDomain, - ?string $credentialsUniverse, - ?string $message = null - ) { - $this->expectException(ValidationException::class); - $this->expectExceptionMessage($message ?: sprintf( - 'The configured universe domain (%s) does not match the credential universe domain (%s)', - is_null($universeDomain) ? GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN : $universeDomain, - is_null($credentialsUniverse) ? GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN : $credentialsUniverse, - )); - $fetcher = $this->prophesize(FetchAuthTokenInterface::class); - // When the $credentialsUniverse is null, the fetcher doesn't implement GetUniverseDomainInterface - if (!is_null($credentialsUniverse)) { - $fetcher->willImplement(GetUniverseDomainInterface::class); - $fetcher->getUniverseDomain()->willReturn($credentialsUniverse); - } - $fetcher->getLastReceivedToken()->willReturn(null); - // When $universeDomain is null, it means no $universeDomain argument was provided - if (is_null($universeDomain)) { - $credentialsWrapper = new CredentialsWrapper($fetcher->reveal()); - } else { - $credentialsWrapper = new CredentialsWrapper($fetcher->reveal(), null, $universeDomain); - } - // Check getBearerString (deprecated) - $credentialsWrapper->getBearerString(); - } - public function provideCheckUniverseDomainFails() { return [ @@ -286,11 +253,6 @@ public function testCheckUniverseDomainPasses(?string $universeDomain, ?string $ ['authorization' => ['Bearer abc']], $credentialsWrapper->getAuthorizationHeaderCallback()() ); - // Check getBearerString (deprecated) - $this->assertEquals( - 'Bearer abc', - $credentialsWrapper->getBearerString() - ); } public function provideCheckUniverseDomainPasses() @@ -316,67 +278,6 @@ public function testCheckUniverseDomainOnGceCredentialsDoesNotCheck() $credentialsWrapper->checkUniverseDomain(); } - /** - * @dataProvider getBearerStringData - */ - public function testGetBearerString($fetcher, $expectedBearerString) - { - $credentialsWrapper = new CredentialsWrapper($fetcher); - $bearerString = $credentialsWrapper->getBearerString(); - $this->assertSame($expectedBearerString, $bearerString); - } - - public function getBearerStringData() - { - $expiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); - $expiredFetcher->getLastReceivedToken() - ->willReturn([ - 'access_token' => 123, - 'expires_at' => time() - 1 - ]); - $expiredFetcher->fetchAuthToken(Argument::any()) - ->willReturn([ - 'access_token' => 456, - 'expires_at' => time() + 1000 - ]); - $eagerExpiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); - $eagerExpiredFetcher->getLastReceivedToken() - ->willReturn([ - 'access_token' => 123, - 'expires_at' => time() + 1 - ]); - $eagerExpiredFetcher->fetchAuthToken(Argument::any()) - ->willReturn([ - 'access_token' => 456, - 'expires_at' => time() + 10 // within 10 second eager threshold - ]); - $unexpiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); - $unexpiredFetcher->getLastReceivedToken() - ->willReturn([ - 'access_token' => 123, - 'expires_at' => time() + 100, - ]); - $insecureFetcher = $this->prophesize(FetchAuthTokenInterface::class); - $insecureFetcher->getLastReceivedToken()->willReturn(null); - $insecureFetcher->fetchAuthToken(Argument::any()) - ->willReturn([ - 'access_token' => '', - ]); - $nullFetcher = $this->prophesize(FetchAuthTokenInterface::class); - $nullFetcher->getLastReceivedToken()->willReturn(null); - $nullFetcher->fetchAuthToken(Argument::any()) - ->willReturn([ - 'access_token' => null, - ]); - return [ - [$expiredFetcher->reveal(), 'Bearer 456'], - [$eagerExpiredFetcher->reveal(), 'Bearer 456'], - [$unexpiredFetcher->reveal(), 'Bearer 123'], - [$insecureFetcher->reveal(), ''], - [$nullFetcher->reveal(), ''] - ]; - } - /** * @dataProvider getAuthorizationHeaderCallbackData */ From 2300f6804e8eb9ef2d1f3b50bdb2ca5d5518b8dc Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 20 Mar 2026 11:11:28 -0700 Subject: [PATCH 3/3] add strict_types --- dev/src/Docs/doctum-protobuf-config.php | 2 ++ src/AgentHeader.php | 4 +++- src/ApiEndpointTrait.php | 2 ++ src/ApiException.php | 2 ++ src/ApiKeyHeaderCredentials.php | 2 ++ src/ApiStatus.php | 2 ++ src/ArrayTrait.php | 2 ++ src/BidiStream.php | 2 ++ src/Call.php | 2 ++ src/ClientOptionsTrait.php | 2 ++ src/ClientStream.php | 2 ++ src/CredentialsWrapper.php | 2 ++ src/FixedSizeCollection.php | 2 ++ src/GPBLabel.php | 2 ++ src/GPBType.php | 2 ++ src/GapicClientTrait.php | 2 ++ src/GrpcSupportTrait.php | 2 ++ src/HeaderCredentialsInterface.php | 2 ++ src/InsecureCredentialsWrapper.php | 2 ++ src/InsecureRequestBuilder.php | 1 + src/KnownTypes.php | 2 ++ src/Middleware/CredentialsWrapperMiddleware.php | 2 ++ src/Middleware/FixedHeaderMiddleware.php | 2 ++ src/Middleware/MiddlewareInterface.php | 2 ++ src/Middleware/OperationsMiddleware.php | 2 ++ src/Middleware/OptionsFilterMiddleware.php | 2 ++ src/Middleware/PagedMiddleware.php | 2 ++ src/Middleware/RequestAutoPopulationMiddleware.php | 2 ++ src/Middleware/ResponseMetadataMiddleware.php | 2 ++ src/Middleware/RetryMiddleware.php | 2 ++ src/Middleware/TransportCallMiddleware.php | 2 ++ src/OperationResponse.php | 2 ++ src/Options/CallOptions.php | 2 ++ src/Options/ClientOptions.php | 2 ++ src/Options/OptionsInterface.php | 2 ++ src/Options/OptionsTrait.php | 2 ++ src/Options/TransportOptions.php | 2 ++ .../TransportOptions/GrpcFallbackTransportOptions.php | 2 ++ src/Options/TransportOptions/GrpcTransportOptions.php | 2 ++ src/Options/TransportOptions/RestTransportOptions.php | 2 ++ src/Page.php | 2 ++ src/PageStreamingDescriptor.php | 2 ++ src/PagedListResponse.php | 2 ++ src/PathTemplate.php | 2 ++ src/PollingTrait.php | 4 +++- src/RequestBuilder.php | 2 ++ src/RequestParamsHeaderDescriptor.php | 2 ++ src/ResourceHelperTrait.php | 2 ++ src/ResourceTemplate/AbsoluteResourceTemplate.php | 2 ++ src/ResourceTemplate/Parser.php | 2 ++ src/ResourceTemplate/RelativeResourceTemplate.php | 6 ++++-- src/ResourceTemplate/ResourceTemplateInterface.php | 2 ++ src/ResourceTemplate/Segment.php | 2 ++ src/RetrySettings.php | 2 ++ src/Serializer.php | 4 +++- src/ServerStream.php | 2 ++ src/ServerStreamingCallInterface.php | 2 ++ src/Testing/GeneratedTest.php | 2 ++ src/Testing/MessageAwareArrayComparator.php | 2 ++ src/Testing/MessageAwareExporter.php | 2 ++ src/Testing/MockBidiStreamingCall.php | 2 ++ src/Testing/MockClientStreamingCall.php | 2 ++ src/Testing/MockGrpcTransport.php | 2 ++ src/Testing/MockServerStreamingCall.php | 2 ++ src/Testing/MockStatus.php | 2 ++ src/Testing/MockStubTrait.php | 2 ++ src/Testing/MockTransport.php | 2 ++ src/Testing/MockUnaryCall.php | 2 ++ src/Testing/ProtobufGPBEmptyComparator.php | 2 ++ src/Testing/ProtobufMessageComparator.php | 2 ++ src/Testing/ReceivedRequest.php | 2 ++ src/Testing/SerializationTrait.php | 2 ++ src/Transport/Grpc/ForwardingCall.php | 2 ++ src/Transport/Grpc/ForwardingServerStreamingCall.php | 2 ++ src/Transport/Grpc/ForwardingUnaryCall.php | 2 ++ src/Transport/Grpc/ServerStreamingCallWrapper.php | 2 ++ src/Transport/GrpcFallbackTransport.php | 2 ++ src/Transport/GrpcTransport.php | 2 ++ src/Transport/HttpUnaryTransportTrait.php | 2 ++ src/Transport/Rest/JsonStreamDecoder.php | 2 ++ src/Transport/Rest/RestServerStreamingCall.php | 2 ++ src/Transport/RestTransport.php | 2 ++ src/Transport/TransportInterface.php | 2 ++ src/UriTrait.php | 2 ++ src/ValidationException.php | 2 ++ src/ValidationTrait.php | 2 ++ src/Version.php | 2 ++ .../src/V1beta1/Client/ComplianceClient.php | 2 ++ tests/Conformance/src/V1beta1/Client/EchoClient.php | 2 ++ .../Conformance/src/V1beta1/Client/IdentityClient.php | 2 ++ .../Conformance/src/V1beta1/Client/MessagingClient.php | 2 ++ .../src/V1beta1/Client/SequenceServiceClient.php | 2 ++ tests/Conformance/src/V1beta1/Client/TestingClient.php | 2 ++ .../V1beta1/resources/compliance_descriptor_config.php | 2 ++ .../resources/compliance_rest_client_config.php | 2 ++ .../src/V1beta1/resources/echo_descriptor_config.php | 2 ++ .../src/V1beta1/resources/echo_rest_client_config.php | 2 ++ .../V1beta1/resources/identity_descriptor_config.php | 2 ++ .../V1beta1/resources/identity_rest_client_config.php | 2 ++ .../V1beta1/resources/messaging_descriptor_config.php | 2 ++ .../V1beta1/resources/messaging_rest_client_config.php | 2 ++ .../resources/sequence_service_descriptor_config.php | 2 ++ .../resources/sequence_service_rest_client_config.php | 2 ++ .../V1beta1/resources/testing_descriptor_config.php | 2 ++ .../V1beta1/resources/testing_rest_client_config.php | 2 ++ tests/Unit/Middleware/OperationsMiddlewareTest.php | 10 +++++----- tests/Unit/testdata/src/GapicClientStub.php | 2 ++ 107 files changed, 221 insertions(+), 10 deletions(-) diff --git a/dev/src/Docs/doctum-protobuf-config.php b/dev/src/Docs/doctum-protobuf-config.php index e0efa81bd..6b98b37c9 100644 --- a/dev/src/Docs/doctum-protobuf-config.php +++ b/dev/src/Docs/doctum-protobuf-config.php @@ -1,4 +1,6 @@ getCurrentTimeMillis() > $endTime) { return false; } - $this->sleepMillis($currentPollDelayMillis); + $this->sleepMillis((int) $currentPollDelayMillis); if ($pollCallable()) { return true; } diff --git a/src/RequestBuilder.php b/src/RequestBuilder.php index b0d589dc4..246991c1f 100644 --- a/src/RequestBuilder.php +++ b/src/RequestBuilder.php @@ -1,4 +1,6 @@ renderingException($bindings, "missing required binding '$key' for segment '$segment'"); } $value = $bindings[$key]; - if (!is_null($value) && $segment->matches($value)) { + if (!is_null($value) && $segment->matches((string) $value)) { $literalSegments[] = new Segment( Segment::LITERAL_SEGMENT, - $value, + (string) $value, $segment->getValue(), $segment->getTemplate(), $segment->getSeparator() diff --git a/src/ResourceTemplate/ResourceTemplateInterface.php b/src/ResourceTemplate/ResourceTemplateInterface.php index ffa3c8138..d5cb1357f 100644 --- a/src/ResourceTemplate/ResourceTemplateInterface.php +++ b/src/ResourceTemplate/ResourceTemplateInterface.php @@ -1,4 +1,6 @@ $values) { foreach ($values as $value) { $decodedValue = ['@type' => $key]; - if (self::hasBinaryHeaderSuffix($key)) { + if (is_string($key) && self::hasBinaryHeaderSuffix($key)) { if (isset(KnownTypes::BIN_TYPES[$key])) { $class = KnownTypes::BIN_TYPES[$key]; /** @var Message $message */ diff --git a/src/ServerStream.php b/src/ServerStream.php index 3257e6550..c659041c5 100644 --- a/src/ServerStream.php +++ b/src/ServerStream.php @@ -1,4 +1,6 @@ prophesize(OperationsClient::class); $descriptor = [ - 'operationNameMethod' => 'getNumber' + 'operationNameMethod' => 'getPageToken' ]; $handler = function (Call $call, $options) use (&$callCount) { return $promise = new Promise(function () use (&$promise) { - $response = new MockResponse(['number' => 123]); + $response = new MockRequest(['page_token' => 'abc']); $promise->resolve($response); }); }; @@ -64,6 +64,6 @@ public function testOperationNameMethodDescriptor() [] )->wait(); - $this->assertEquals(123, $response->getName()); + $this->assertEquals('abc', $response->getName()); } } diff --git a/tests/Unit/testdata/src/GapicClientStub.php b/tests/Unit/testdata/src/GapicClientStub.php index ce1eff153..d045f427d 100644 --- a/tests/Unit/testdata/src/GapicClientStub.php +++ b/tests/Unit/testdata/src/GapicClientStub.php @@ -1,4 +1,6 @@