Skip to content

Commit be19ee6

Browse files
authored
chore: remove deprecated setAccessible (#8873)
1 parent 6b57a02 commit be19ee6

File tree

21 files changed

+1
-61
lines changed

21 files changed

+1
-61
lines changed

BigQuery/tests/Unit/Connection/RestTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function testApiEndpointForUniverseDomain(
6161

6262
$r = new \ReflectionClass($rest);
6363
$p = $r->getProperty('apiEndpoint');
64-
$p->setAccessible(true);
6564

6665
if ($envUniverse) {
6766
// We have to do this instead of using "@runInSeparateProcess" because in the case of

Bigtable/tests/Conformance/proxy/src/ProxyService.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Google\Cloud\Bigtable\V2\ReadRowsRequest;
2222
use Google\Cloud\Bigtable\V2\Row;
2323
use Google\Cloud\Bigtable\V2\SampleRowKeysResponse;
24-
use Google\Protobuf\Internal\RepeatedField;
24+
use Google\Protobuf\RepeatedField;
2525
use Google\Rpc\Status;
2626
use Grpc\ChannelCredentials;
2727
use Monolog\Level;
@@ -638,7 +638,6 @@ private function protoToMutations(RepeatedField|null $protoMutations): Mutations
638638
$mutations = new Mutations();
639639
$reflection = new \ReflectionClass($mutations);
640640
$property = $reflection->getProperty('mutations');
641-
$property->setAccessible(true);
642641
$property->setValue($mutations, $protoMutations);
643642

644643
return $mutations;
@@ -653,7 +652,6 @@ private function protoToRowRules(RepeatedField $protoRowRules): ReadModifyWriteR
653652
$rowRules = new ReadModifyWriteRowRules();
654653
$reflection = new \ReflectionClass($rowRules);
655654
$property = $reflection->getProperty('rules');
656-
$property->setAccessible(true);
657655
$property->setValue($rowRules, $protoRowRules);
658656

659657
return $rowRules;

Bigtable/tests/Unit/ResumableStreamTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function testRetryDelayAndAttemptAreResetWhenRowReceived()
8686
}, $delayFactor);
8787
};
8888
$prop = (new \ReflectionObject($resumableStream))->getProperty('delayFunction');
89-
$prop->setAccessible(true);
9089
$prop->setValue($resumableStream, $delayFunction);
9190

9291
$rows = iterator_to_array($resumableStream->readAll());

Core/src/Testing/StubTrait.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ trait StubTrait
3535
public function ___getProperty($prop)
3636
{
3737
$property = $this->___getPropertyReflector($prop);
38-
39-
$property->setAccessible(true);
4038
return $property->getValue($this);
4139
}
4240

@@ -54,8 +52,6 @@ public function ___setProperty($prop, $value)
5452
}
5553

5654
$property = $this->___getPropertyReflector($prop);
57-
58-
$property->setAccessible(true);
5955
$property->setValue($this, $value);
6056
}
6157

Core/tests/Unit/Batch/SysvConfigStorageTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,10 @@ public function testDefaultValues()
113113
putenv('GOOGLE_CLOUD_BATCH_PROJECT');
114114
$r = new \ReflectionObject($this->storage);
115115
$p = $r->getProperty('shmSize');
116-
$p->setAccessible(true);
117116
$this->assertEquals(200000, $p->getValue($this->storage));
118117
$p = $r->getProperty('perm');
119-
$p->setAccessible(true);
120118
$this->assertEquals(0600, $p->getValue($this->storage));
121119
$p = $r->getProperty('project');
122-
$p->setAccessible(true);
123120
$this->assertEquals('A', $p->getValue($this->storage));
124121
}
125122

@@ -131,13 +128,10 @@ public function testEnvVarCustomization()
131128
$storage = new SysvConfigStorage();
132129
$r = new \ReflectionObject($storage);
133130
$p = $r->getProperty('shmSize');
134-
$p->setAccessible(true);
135131
$this->assertEquals(10, $p->getValue($storage));
136132
$p = $r->getProperty('perm');
137-
$p->setAccessible(true);
138133
$this->assertEquals(0666, $p->getValue($storage));
139134
$p = $r->getProperty('project');
140-
$p->setAccessible(true);
141135
$this->assertEquals('B', $p->getValue($storage));
142136
}
143137
}

Core/tests/Unit/GrpcTraitTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ public function testUniverseDomainFromGaxConfig(
222222
$config = $impl->getGaxConfig('1.2.3', null, $universeDomain);
223223
$refl = new \ReflectionClass($config['credentials']);
224224
$prop = $refl->getProperty('universeDomain');
225-
$prop->setAccessible(true);
226225
$universeDomain = $prop->getValue($config['credentials']);
227226

228227
if ($envUniverse) {

Core/tests/Unit/RequestWrapperTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,12 @@ public function testUsesSelfSignedJwtWithScopeByDefault()
586586
// Assert Service Account Credentials
587587
$cacheRefClass = new \ReflectionClass($fetcherCache);
588588
$cacheProp = $cacheRefClass->getProperty('fetcher');
589-
$cacheProp->setAccessible(true);
590589
$fetcher = $cacheProp->getValue($fetcherCache);
591590
$this->assertInstanceOf(ServiceAccountCredentials::class, $fetcher);
592591

593592
// Assert "JWT Access With Scope" is enabled by default
594593
$fetcherRefClass = new \ReflectionClass($fetcher);
595594
$fetcherProp = $fetcherRefClass->getProperty('useJwtAccessWithScope');
596-
$fetcherProp->setAccessible(true);
597595
$this->assertTrue($fetcherProp->getValue($fetcher));
598596

599597
// Assert a JWT token is created without using HTTP
@@ -871,8 +869,6 @@ public function testRetryListenerOnConstructor()
871869

872870
$reflectionClass = new ReflectionClass($wrapper);
873871
$property = $reflectionClass->getProperty('retryListener');
874-
$property->setAccessible(true);
875-
876872
$this->assertNotEmpty($property->getValue($wrapper), 'The retryListener property should be set.');
877873
$this->assertEquals(
878874
$listener,

Core/tests/Unit/ServiceBuilderTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public function testKeyfilePathAuthPassthrough(
9191

9292
$ref = new \ReflectionClass($client);
9393
$prop = $ref->getProperty('connection');
94-
$prop->setAccessible(true);
9594
$conn = $prop->getValue($client);
9695
$conn->requestWrapper()
9796
->getCredentialsFetcher()
@@ -129,7 +128,6 @@ public function testKeyfileAuthPassthrough(
129128

130129
$ref = new \ReflectionClass($client);
131130
$prop = $ref->getProperty('connection');
132-
$prop->setAccessible(true);
133131
$conn = $prop->getValue($client);
134132
$conn->requestWrapper()
135133
->getCredentialsFetcher()

Core/tests/Unit/Upload/ResumableUploaderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ public function testThrowsExceptionWithFailedUpload()
300300
public function testGetRangeStart($rangeHeader, $expectedRangeStart)
301301
{
302302
$method = new \ReflectionMethod(ResumableUploader::class, 'getRangeStart');
303-
$method->setAccessible(true);
304303

305304
$uploader = $this->createMock(ResumableUploader::class);
306305

Datastore/tests/Snippet/DatastoreClientTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,10 @@ public function testMultiTenant()
100100

101101
$ref = new \ReflectionClass($ds);
102102
$opProp = $ref->getProperty('operation');
103-
$opProp->setAccessible(true);
104-
105103
$op = $opProp->getValue($ds);
106104

107105
$opRef = new \ReflectionClass($op);
108106
$nsProp = $opRef->getProperty('namespaceId');
109-
$nsProp->setAccessible(true);
110107

111108
$this->assertEquals('my-application-namespace', $nsProp->getValue($op));
112109
}
@@ -122,13 +119,10 @@ public function testMultipleDatabases()
122119

123120
$ref = new \ReflectionClass($ds);
124121
$opProp = $ref->getProperty('operation');
125-
$opProp->setAccessible(true);
126-
127122
$op = $opProp->getValue($ds);
128123

129124
$opRef = new \ReflectionClass($op);
130125
$dsProp = $opRef->getProperty('databaseId');
131-
$dsProp->setAccessible(true);
132126

133127
$this->assertEquals('my-database', $dsProp->getValue($op));
134128
}

0 commit comments

Comments
 (0)