Skip to content

Commit c7533d9

Browse files
authored
Merge pull request #661 from arshidkv12/php85
Fix(reflection): avoid deprecated setAccessible() in PHP 8.5+
2 parents f0dc1b1 + 3884da4 commit c7533d9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/PdoWrapperTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ public function testPullDataFromDsn(): void
128128
// Testing protected method using reflection
129129
$reflection = new ReflectionClass($this->pdo_wrapper);
130130
$method = $reflection->getMethod('pullDataFromDsn');
131-
$method->setAccessible(true);
131+
if (PHP_VERSION_ID < 80100) {
132+
$method->setAccessible(true);
133+
}
132134

133135
// Test SQLite DSN
134136
$sqliteDsn = 'sqlite::memory:';
@@ -205,7 +207,9 @@ public function testLogQueries(): void
205207
// Verify metrics are reset after logging
206208
$reflection = new ReflectionClass($trackingPdo);
207209
$property = $reflection->getProperty('queryMetrics');
208-
$property->setAccessible(true);
210+
if (PHP_VERSION_ID < 80100) {
211+
$property->setAccessible(true);
212+
}
209213
$this->assertCount(0, $property->getValue($trackingPdo));
210214
}
211215
}

0 commit comments

Comments
 (0)