diff --git a/thrift/lib/hack/src/ThriftContextPropState.php b/thrift/lib/hack/src/ThriftContextPropState.php index a3d57884728..40ede8e6316 100644 --- a/thrift/lib/hack/src/ThriftContextPropState.php +++ b/thrift/lib/hack/src/ThriftContextPropState.php @@ -315,7 +315,14 @@ public function setExperimentIds(vec $eids)[write_props]: void { $this->dirty(); } - public function getPrivacyUniverse()[]: ?int { + /** + * This should not be exposed publicly, and instead call + * getPrivacyUniverseDesignator + * + * @return the raw privacy universe as an int. + * @see getPrivacyUniverseDesignator + */ + private function getPrivacyUniverse()[]: ?int { return $this->storage->privacyUniverse; } diff --git a/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php b/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php index b905baa8542..60073c79f7e 100644 --- a/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php +++ b/thrift/lib/hack/src/__tests__/ThriftContextPropStateTest.php @@ -105,9 +105,10 @@ public function testTraceContext(): void { public function testPrivacyUniverse(): void { $tcps = ThriftContextPropState::get(); - expect($tcps->getPrivacyUniverse())->toBeNull(); + expect($tcps->getPrivacyUniverseDesignator())->toBeNull(); $tcps->setPrivacyUniverse(123); - expect($tcps->getPrivacyUniverse())->toEqual(123); + expect($tcps->getPrivacyUniverseDesignator()?->getValue())->toNotBeNullAnd() + ->toEqual(123); } public function testInitialization()[defaults]: void { diff --git a/thrift/lib/hack/src/contextprop/ImmutableThriftContextPropState.php b/thrift/lib/hack/src/contextprop/ImmutableThriftContextPropState.php index 349b6b01a05..ab7e517b388 100644 --- a/thrift/lib/hack/src/contextprop/ImmutableThriftContextPropState.php +++ b/thrift/lib/hack/src/contextprop/ImmutableThriftContextPropState.php @@ -57,7 +57,7 @@ public function getExperimentIds()[]: vec { } public function getPrivacyUniverse()[]: ?int { - return $this->state->getPrivacyUniverse(); + return $this->state->getPrivacyUniverseDesignator()?->getValue(); } public function getRequestPriority()[]: ?RequestPriority { diff --git a/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php b/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php index c3e7d4e484c..b0f4ee5a979 100644 --- a/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php +++ b/thrift/lib/hack/src/contextprop/__tests__/UpdateUniverseContextHandlerTest.php @@ -184,7 +184,7 @@ classname $thrift_service_name, private function assertNullUniverse(): void { $context_prop_state = ThriftContextPropState::get(); expect($context_prop_state)->toNotBeNull(); - expect($context_prop_state->getPrivacyUniverse())->toBeNull(); + expect($context_prop_state->getPrivacyUniverseDesignator())->toBeNull(); } private function assertUniverse(